Corrected Director
This commit is contained in:
22
Dir Config/scripts/webhooks/ChrisProElite-Bacula-Webhook.py
Normal file
22
Dir Config/scripts/webhooks/ChrisProElite-Bacula-Webhook.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed
|
||||
|
||||
webhookURL = "https://discordapp.com/api/webhooks/742784012640190565/NBhtbWpDdgMZPx7uCXO8Ofw-o8Lez0V17EBGIvYv7FTIeTENK24GHNL3krUbYnOOIJ63"
|
||||
maxCharPerMessage = 1994
|
||||
|
||||
with open ("/etc/bacula/scripts/webhooks/ChrisProEliteMail.md", "r") as myfile:
|
||||
cleaned_stdout=myfile.read()
|
||||
|
||||
if "Termination: Backup OK" in cleaned_stdout:
|
||||
truncated_stdout = ["Job Backup-Chris completed with status Backup OK, omitting full report.\nAll data from nextcloud was successfully written to tape on " + datetime.now().strftime("%d/%m/%Y %H:%M:%S") + "."]
|
||||
else:
|
||||
# Discord limits each message to 2000 chars, if the message is longer than that, truncate it
|
||||
truncated_stdout = [cleaned_stdout[i:i+maxCharPerMessage] for i in range(0, len(cleaned_stdout), maxCharPerMessage)]
|
||||
|
||||
print (truncated_stdout) # Print the truncated message
|
||||
|
||||
|
||||
for message_part in truncated_stdout: # For every message part in the truncated output, run this loop
|
||||
message_part = "```" + message_part + "```" # Encapsulate the messsage
|
||||
print(message_part)
|
||||
webhook = DiscordWebhook(url=webhookURL, content=message_part) # Attach the message
|
||||
response = webhook.execute() # Hit send
|
||||
52
Dir Config/scripts/webhooks/ChrisProEliteMail.md
Normal file
52
Dir Config/scripts/webhooks/ChrisProEliteMail.md
Normal file
@@ -0,0 +1,52 @@
|
||||
11-Aug 12:41 bacula-dir JobId 310: Start Backup JobId 310, Job=Backup-Chris.2020-08-11_12.41.09_06
|
||||
11-Aug 12:41 bacula-dir JobId 310: Using Device "Drive-1-LTO-3" to write.
|
||||
11-Aug 12:41 bacula-iron-sd JobId 310: 3304 Issuing autochanger "load Volume PF6866, Slot 7, Drive 1" command.
|
||||
11-Aug 12:41 bacula-iron-sd JobId 310: 3305 Autochanger "load Volume PF6866, Slot 7, Drive 1", status is OK.
|
||||
11-Aug 12:41 bacula-iron-sd JobId 310: Volume "PF6866" previously written, moving to end of data.
|
||||
11-Aug 12:42 bacula-iron-sd JobId 310: Ready to append to end of Volume "PF6866" at file=76.
|
||||
11-Aug 12:42 bacula-iron-sd JobId 310: Spooling data ...
|
||||
11-Aug 12:42 bacula-iron-sd JobId 310: Committing spooled data to Volume "PF6866". Despooling 430 bytes ...
|
||||
11-Aug 12:42 bacula-iron-sd JobId 310: Despooling elapsed time = 00:00:01, Transfer rate = 430 Bytes/second
|
||||
11-Aug 12:42 bacula-iron-sd JobId 310: Elapsed time=00:00:01, Transfer rate=0 Bytes/second
|
||||
11-Aug 12:43 bacula-iron-sd JobId 310: Sending spooled attrs to the Director. Despooling 0 bytes ...
|
||||
11-Aug 12:43 bacula-dir JobId 310: Bacula bacula-dir 9.4.2 (04Feb19):
|
||||
Build OS: x86_64-pc-linux-gnu ubuntu 20.04
|
||||
JobId: 310
|
||||
Job: Backup-Chris.2020-08-11_12.41.09_06
|
||||
Backup Level: Incremental, since=2020-08-11 02:29:34
|
||||
Client: "Zinc-Client" 9.6.3 (09Mar20) amd64-portbld-freebsd11.3,freebsd,11.3-RELEASE-p8
|
||||
FileSet: "Chris Backup" 2020-06-23 16:46:12
|
||||
Pool: "Incr-Pool" (From Job IncPool override)
|
||||
Catalog: "MyCatalog" (From Client resource)
|
||||
Storage: "Iron-Autochanger" (From Pool resource)
|
||||
Scheduled time: 11-Aug-2020 12:41:08
|
||||
Start time: 11-Aug-2020 12:41:12
|
||||
End time: 11-Aug-2020 12:43:00
|
||||
Elapsed time: 1 min 48 secs
|
||||
Priority: 10
|
||||
FD Files Written: 0
|
||||
SD Files Written: 0
|
||||
FD Bytes Written: 0 (0 B)
|
||||
SD Bytes Written: 0 (0 B)
|
||||
Rate: 0.0 KB/s
|
||||
Software Compression: None
|
||||
Comm Line Compression: None
|
||||
Snapshot/VSS: no
|
||||
Encryption: no
|
||||
Accurate: no
|
||||
Volume name(s):
|
||||
Volume Session Id: 13
|
||||
Volume Session Time: 1596908811
|
||||
Last Volume Bytes: 239,752,719,360 (239.7 GB)
|
||||
Non-fatal FD errors: 0
|
||||
SD Errors: 0
|
||||
FD termination status: OK
|
||||
SD termination status: OK
|
||||
Termination: Backup OK
|
||||
|
||||
11-Aug 12:43 bacula-dir JobId 310: Begin pruning Jobs older than 30 years .
|
||||
11-Aug 12:43 bacula-dir JobId 310: No Jobs found to prune.
|
||||
11-Aug 12:43 bacula-dir JobId 310: Begin pruning Files.
|
||||
11-Aug 12:43 bacula-dir JobId 310: No Files found to prune.
|
||||
11-Aug 12:43 bacula-dir JobId 310: End auto prune.
|
||||
|
||||
23
Dir Config/scripts/webhooks/Robotics-Bacula-Webhook.py
Normal file
23
Dir Config/scripts/webhooks/Robotics-Bacula-Webhook.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed
|
||||
from datetime import datetime
|
||||
|
||||
webhookURL = "https://discordapp.com/api/webhooks/740630755259973713/CNhxPBJ4C6UZ-m1DVXUQ54KeJQD3I9Di0sAwldmyjw-s7dMPUWplq7rhGXegpWGtKSve"
|
||||
maxCharPerMessage = 1994
|
||||
|
||||
with open ("/etc/bacula/scripts/webhooks/RoboticsMail.md", "r") as myfile:
|
||||
cleaned_stdout=myfile.read()
|
||||
|
||||
if "Termination: Backup OK" in cleaned_stdout:
|
||||
truncated_stdout = ["Job Backup-Robotics completed with status Backup OK, omitting full report.\nAll data from google drive was successfully written to tape on " + datetime.now().strftime("%d/%m/%Y %H:%M:%S") + "."]
|
||||
else:
|
||||
# Discord limits each message to 2000 chars, if the message is longer than that, truncate it
|
||||
truncated_stdout = [cleaned_stdout[i:i+maxCharPerMessage] for i in range(0, len(cleaned_stdout), maxCharPerMessage)]
|
||||
|
||||
print (truncated_stdout) # Print the truncated message
|
||||
|
||||
|
||||
for message_part in truncated_stdout: # For every message part in the truncated output, run this loop
|
||||
message_part = "```" + message_part + "```" # Encapsulate the messsage
|
||||
print(message_part)
|
||||
webhook = DiscordWebhook(url=webhookURL, content=message_part) # Attach the message
|
||||
response = webhook.execute() # Hit send
|
||||
47
Dir Config/scripts/webhooks/RoboticsMail.md
Normal file
47
Dir Config/scripts/webhooks/RoboticsMail.md
Normal file
@@ -0,0 +1,47 @@
|
||||
11-Aug 02:56 bacula-dir JobId 308: Start Backup JobId 308, Job=Backup-Robotics.2020-08-11_02.15.00_10
|
||||
11-Aug 02:56 bacula-dir JobId 308: Using Device "Drive-1-LTO-3" to write.
|
||||
11-Aug 02:56 bacula-iron-sd JobId 308: Spooling data ...
|
||||
11-Aug 02:56 bacula-iron-sd JobId 308: Committing spooled data to Volume "PF6866". Despooling 788,279,412 bytes ...
|
||||
11-Aug 02:56 bacula-iron-sd JobId 308: Despooling elapsed time = 00:00:12, Transfer rate = 65.68 M Bytes/second
|
||||
11-Aug 02:56 bacula-iron-sd JobId 308: Elapsed time=00:00:27, Transfer rate=29.16 M Bytes/second
|
||||
11-Aug 02:56 bacula-iron-sd JobId 308: Sending spooled attrs to the Director. Despooling 24,152 bytes ...
|
||||
11-Aug 02:56 bacula-dir JobId 308: Bacula bacula-dir 9.4.2 (04Feb19):
|
||||
Build OS: x86_64-pc-linux-gnu ubuntu 20.04
|
||||
JobId: 308
|
||||
Job: Backup-Robotics.2020-08-11_02.15.00_10
|
||||
Backup Level: Incremental, since=2020-08-07 15:31:45
|
||||
Client: "Zinc-Client" 9.6.3 (09Mar20) amd64-portbld-freebsd11.3,freebsd,11.3-RELEASE-p8
|
||||
FileSet: "Google-Drive Robotics" 2020-08-05 15:36:42
|
||||
Pool: "Incr-Pool" (From Job IncPool override)
|
||||
Catalog: "MyCatalog" (From Client resource)
|
||||
Storage: "Iron-Autochanger" (From Pool resource)
|
||||
Scheduled time: 11-Aug-2020 02:15:00
|
||||
Start time: 11-Aug-2020 02:56:27
|
||||
End time: 11-Aug-2020 02:56:55
|
||||
Elapsed time: 28 secs
|
||||
Priority: 10
|
||||
FD Files Written: 98
|
||||
SD Files Written: 98
|
||||
FD Bytes Written: 787,531,312 (787.5 MB)
|
||||
SD Bytes Written: 787,545,944 (787.5 MB)
|
||||
Rate: 28126.1 KB/s
|
||||
Software Compression: None
|
||||
Comm Line Compression: 1.2% 1.0:1
|
||||
Snapshot/VSS: no
|
||||
Encryption: no
|
||||
Accurate: no
|
||||
Volume name(s): PF6866
|
||||
Volume Session Id: 12
|
||||
Volume Session Time: 1596908811
|
||||
Last Volume Bytes: 239,752,654,848 (239.7 GB)
|
||||
Non-fatal FD errors: 0
|
||||
SD Errors: 0
|
||||
FD termination status: OK
|
||||
SD termination status: OK
|
||||
Termination: Backup OK
|
||||
|
||||
11-Aug 02:56 bacula-dir JobId 308: Begin pruning Jobs older than 30 years .
|
||||
11-Aug 02:56 bacula-dir JobId 308: No Jobs found to prune.
|
||||
11-Aug 02:56 bacula-dir JobId 308: Begin pruning Files.
|
||||
11-Aug 02:56 bacula-dir JobId 308: No Files found to prune.
|
||||
11-Aug 02:56 bacula-dir JobId 308: End auto prune.
|
||||
Reference in New Issue
Block a user