diff --git a/Dir Config/bacula-dir.conf b/Dir Config/bacula-dir.conf index b747c84..6f3bab6 100644 --- a/Dir Config/bacula-dir.conf +++ b/Dir Config/bacula-dir.conf @@ -35,7 +35,7 @@ Autochanger { # New resource Password = "iamnotacrook" Device = Drive-1-LTO-3, Drive-0-LTO-3 Media Type = LTO-3 - Maximum Concurrent Jobs = 3 + Maximum Concurrent Jobs = 2 } Storage { # Can have multiple of these per autochanger @@ -169,3 +169,11 @@ messages { # Send mail to me and Julio console = all, !skipped, !saved catalog = all } + +messages { # Send mail to me and Aidan + name = AidanMail + mail = 5730dogman@gmail.com ,kenwood364@gmail.com = all, !skipped + file = "/etc/bacula/scripts/webhooks/Aidan-Bacula-Mail.md" = all, !skipped + console = all, !skipped, !saved + catalog = all +} diff --git a/Dir Config/clients/zinc-client-users.conf b/Dir Config/clients/zinc-client-users.conf index 633173c..1e77eb4 100644 --- a/Dir Config/clients/zinc-client-users.conf +++ b/Dir Config/clients/zinc-client-users.conf @@ -24,7 +24,6 @@ Job { # Backup Michael Name = "Backup-Michael" JobDefs = "Default-User-Job" FileSet = "Michael Backup" - Messages = MikesMail } Job { # Backup Matthew @@ -60,3 +59,10 @@ Job { # Backup Julio FileSet = "Julio Backup" Messages = JuliosMail } + +Job { # Backup Aidan + Name = "Backup-Aidan" + JobDefs = "Default-User-Job" + FileSet = "Aidan Backup" + Messages = AidanMail +} \ No newline at end of file diff --git a/Dir Config/filesets/filesets-archive.conf b/Dir Config/filesets/filesets-archive.conf index 1596486..f645503 100644 --- a/Dir Config/filesets/filesets-archive.conf +++ b/Dir Config/filesets/filesets-archive.conf @@ -28,7 +28,7 @@ FileSet { Options { signature = MD5 } - File = "/mnt/Archive/Christina/" + File = "/mnt/Archive/Christina_Archive/" File = "/mnt/Archive/Aux-Christina/" } } diff --git a/Dir Config/filesets/filesets-system.conf b/Dir Config/filesets/filesets-system.conf index 5aa0f6c..25e85e7 100644 --- a/Dir Config/filesets/filesets-system.conf +++ b/Dir Config/filesets/filesets-system.conf @@ -26,14 +26,18 @@ FileSet { # Backup proxmox backups FileSet { Name = "Proxmox Backups" - Include { - Options { - signature = MD5 - } - File = "/mnt/Proxmox/" + Include { + Options { + wilddir = "*.tmp" # Ignore directories matching *.tmp + signature = MD5 + exclude = yes + } + File = "/mnt/Proxmox" } } + + # Backup 1721's Google Drives FileSet { Name = "Google-Drive Robotics" diff --git a/Dir Config/filesets/filesets-users.conf b/Dir Config/filesets/filesets-users.conf index d50b1af..d5e026f 100644 --- a/Dir Config/filesets/filesets-users.conf +++ b/Dir Config/filesets/filesets-users.conf @@ -137,3 +137,15 @@ FileSet { File = "/mnt/NextCloud/data/julio/" } } + +# Aidan's backup on zinc +FileSet { + Name = "Aidan Backup" + Include { + Options { + signature = MD5 + compression=GZIP + } + File = "/mnt/NextCloud/data/aidan/" + } +} diff --git a/Dir Config/pools.conf b/Dir Config/pools.conf index fc5f015..d5888a3 100644 --- a/Dir Config/pools.conf +++ b/Dir Config/pools.conf @@ -4,7 +4,7 @@ Pool { Recycle = yes # Allow these vols to be recycled Recycle Pool = Scratch # Where to put the vol after recycling AutoPrune = yes # Automaticly schedule for recycling - Volume Retention = 6 months # When to auto schedule for recycling + Volume Retention = 4.5 months # When to auto schedule for recycling Storage = Iron-Autochanger Maximum Volume Bytes = 800G diff --git a/Dir Config/scripts/webhooks/._sync_3f5c94a4c959.db b/Dir Config/scripts/webhooks/._sync_3f5c94a4c959.db index f7974fb..8c1e799 100644 Binary files a/Dir Config/scripts/webhooks/._sync_3f5c94a4c959.db and b/Dir Config/scripts/webhooks/._sync_3f5c94a4c959.db differ diff --git a/Dir Config/scripts/webhooks/Aidan-Bacula-Mail.md b/Dir Config/scripts/webhooks/Aidan-Bacula-Mail.md new file mode 100644 index 0000000..642552a --- /dev/null +++ b/Dir Config/scripts/webhooks/Aidan-Bacula-Mail.md @@ -0,0 +1,54 @@ +23-Sep 23:59 bacula-dir JobId 437: No prior Full backup Job record found. +23-Sep 23:59 bacula-dir JobId 437: No prior or suitable Full backup found in catalog. Doing FULL backup. +23-Sep 23:59 bacula-dir JobId 437: Start Backup JobId 437, Job=Backup-Aidan.2020-09-23_23.59.41_16 +23-Sep 23:59 bacula-dir JobId 437: Using Device "Drive-1-LTO-3" to write. +24-Sep 00:00 bacula-iron-sd JobId 437: 3304 Issuing autochanger "load Volume A00718, Slot 2, Drive 1" command. +24-Sep 00:00 bacula-iron-sd JobId 437: 3305 Autochanger "load Volume A00718, Slot 2, Drive 1", status is OK. +24-Sep 00:00 bacula-iron-sd JobId 437: Volume "A00718" previously written, moving to end of data. +24-Sep 00:06 bacula-iron-sd JobId 437: Ready to append to end of Volume "A00718" at file=85. +24-Sep 00:06 bacula-iron-sd JobId 437: Spooling data ... +24-Sep 00:06 bacula-iron-sd JobId 437: Committing spooled data to Volume "A00718". Despooling 16,131,668 bytes ... +24-Sep 00:06 bacula-iron-sd JobId 437: Despooling elapsed time = 00:00:01, Transfer rate = 16.13 M Bytes/second +24-Sep 00:06 bacula-iron-sd JobId 437: Elapsed time=00:00:02, Transfer rate=8.057 M Bytes/second +24-Sep 00:06 bacula-iron-sd JobId 437: Sending spooled attrs to the Director. Despooling 4,978 bytes ... +24-Sep 00:06 bacula-dir JobId 437: Bacula bacula-dir 9.4.2 (04Feb19): + Build OS: x86_64-pc-linux-gnu ubuntu 20.04 + JobId: 437 + Job: Backup-Aidan.2020-09-23_23.59.41_16 + Backup Level: Full (upgraded from Incremental) + Client: "Zinc-Client" 9.6.3 (09Mar20) amd64-portbld-freebsd11.3,freebsd,11.3-RELEASE-p8 + FileSet: "Aidan Backup" 2020-09-23 23:43:52 + Pool: "Full-Pool" (From Job FullPool override) + Catalog: "MyCatalog" (From Client resource) + Storage: "Iron-Autochanger" (From Pool resource) + Scheduled time: 23-Sep-2020 23:59:40 + Start time: 23-Sep-2020 23:59:43 + End time: 24-Sep-2020 00:06:32 + Elapsed time: 6 mins 49 secs + Priority: 10 + FD Files Written: 21 + SD Files Written: 21 + FD Bytes Written: 16,112,636 (16.11 MB) + SD Bytes Written: 16,115,542 (16.11 MB) + Rate: 39.4 KB/s + Software Compression: 5.8% 1.1:1 + Comm Line Compression: None + Snapshot/VSS: no + Encryption: no + Accurate: no + Volume name(s): A00718 + Volume Session Id: 25 + Volume Session Time: 1599755230 + Last Volume Bytes: 338,586,587,136 (338.5 GB) + Non-fatal FD errors: 0 + SD Errors: 0 + FD termination status: OK + SD termination status: OK + Termination: Backup OK + +24-Sep 00:06 bacula-dir JobId 437: Begin pruning Jobs older than 30 years . +24-Sep 00:06 bacula-dir JobId 437: No Jobs found to prune. +24-Sep 00:06 bacula-dir JobId 437: Begin pruning Files. +24-Sep 00:06 bacula-dir JobId 437: No Files found to prune. +24-Sep 00:06 bacula-dir JobId 437: End auto prune. + diff --git a/Dir Config/scripts/webhooks/Aidan-Bacula-Webhook.py b/Dir Config/scripts/webhooks/Aidan-Bacula-Webhook.py new file mode 100644 index 0000000..2f942f1 --- /dev/null +++ b/Dir Config/scripts/webhooks/Aidan-Bacula-Webhook.py @@ -0,0 +1,20 @@ +from discord_webhook import DiscordWebhook, DiscordEmbed +from bathook import bathook + +webhookURL = "https://discordapp.com/api/webhooks/758550057598582804/DogsHl5AEKwMr01LJ_ddSUuAZcfW2eCEybZDGFjBUMIBKTVXCvD7D2d2I6zDNaoQNu1j" +maxCharPerMessage = 1994 + +bathook = bathook("/etc/bacula/scripts/webhooks/Aidan-Bacula-Mail.md", "SporkMC (and mounted storages)") + +for message_part in bathook.get_formatted_message(): # For every message part in the truncated output, run this loop + # Form the embedded stuff (unique for aidan's server) + #embed = DiscordEmbed() + #embed.set_author(name="Snowsune's Tape Daemon", icon_url="https://kitsunehosting.net/nextcloud/index.php/apps/files_sharing/publicpreview/zzygHFxJQXjXxMz?x=1920&y=553&a=true&file=TapeImage.JPG&scalingup=0") + #embed.set_timestamp() + #embed.add_embed_field(name='Field 1', value='Lorem ipsum') + + message_part = "```" + message_part + "```" # Encapsulate the messsage + print(message_part) + webhook = DiscordWebhook(url=webhookURL, username="Snowsune's SporkMC Bacula Daemon", content=message_part) # Attach the message + #webhook.add_embed(embed) + response = webhook.execute() # Hit send diff --git a/Dir Config/scripts/webhooks/ChrisProEliteMail.md b/Dir Config/scripts/webhooks/ChrisProEliteMail.md index 4b4a156..ca2d5dd 100644 --- a/Dir Config/scripts/webhooks/ChrisProEliteMail.md +++ b/Dir Config/scripts/webhooks/ChrisProEliteMail.md @@ -1,96 +1,48 @@ -25-Aug 04:00 bacula-dir JobId 356: Start Backup JobId 356, Job=Backup-Chris.2020-08-25_04.00.36_39 -25-Aug 04:00 bacula-dir JobId 356: Using Device "Drive-1-LTO-3" to write. -25-Aug 04:00 bacula-dir JobId 356: Warning: bsockcore.c:201 Could not connect to Client: Zinc-Client on 10.85.3.31:9102. ERR=No route to host -Retrying ... -25-Aug 04:03 bacula-dir JobId 356: Fatal error: bsockcore.c:208 Unable to connect to Client: Zinc-Client on 10.85.3.31:9102. ERR=No route to host -25-Aug 04:03 bacula-dir JobId 356: Fatal error: No Job status returned from FD. -25-Aug 04:03 bacula-dir JobId 356: Error: Bacula bacula-dir 9.4.2 (04Feb19): +22-Sep 02:24 bacula-dir JobId 430: Start Backup JobId 430, Job=Backup-Chris.2020-09-22_02.15.00_18 +22-Sep 02:24 bacula-dir JobId 430: Using Device "Drive-0-LTO-3" to write. +22-Sep 02:24 bacula-iron-sd JobId 430: Spooling data ... +22-Sep 02:24 bacula-iron-sd JobId 430: Committing spooled data to Volume "A02106". Despooling 912 bytes ... +22-Sep 02:24 bacula-iron-sd JobId 430: Despooling elapsed time = 00:00:01, Transfer rate = 912 Bytes/second +22-Sep 02:24 bacula-iron-sd JobId 430: Elapsed time=00:00:03, Transfer rate=144 Bytes/second +22-Sep 02:24 bacula-iron-sd JobId 430: Sending spooled attrs to the Director. Despooling 658 bytes ... +22-Sep 02:24 bacula-dir JobId 430: Bacula bacula-dir 9.4.2 (04Feb19): Build OS: x86_64-pc-linux-gnu ubuntu 20.04 - JobId: 356 - Job: Backup-Chris.2020-08-25_04.00.36_39 - Backup Level: Incremental, since=2020-08-22 16:20:07 + JobId: 430 + Job: Backup-Chris.2020-09-22_02.15.00_18 + Backup Level: Incremental, since=2020-09-15 02:19:54 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: 25-Aug-2020 04:00:35 - Start time: 25-Aug-2020 04:00:38 - End time: 25-Aug-2020 04:03:38 - Elapsed time: 3 mins + Scheduled time: 22-Sep-2020 02:15:00 + Start time: 22-Sep-2020 02:24:36 + End time: 22-Sep-2020 02:24:40 + Elapsed time: 4 secs Priority: 10 - FD Files Written: 0 - SD Files Written: 0 + FD Files Written: 4 + SD Files Written: 4 FD Bytes Written: 0 (0 B) - SD Bytes Written: 0 (0 B) + SD Bytes Written: 434 (434 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: 1 - Volume Session Time: 1598338861 - Last Volume Bytes: 6,785,888,256 (6.785 GB) - Non-fatal FD errors: 1 - SD Errors: 0 - FD termination status: Error - SD termination status: Waiting on FD - Termination: *** Backup Error *** - -25-Aug 04:03 bacula-dir JobId 356: Rescheduled Job Backup-Chris.2020-08-25_04.00.36_39 at 25-Aug-2020 04:03 to re-run in 43200 seconds (25-Aug-2020 16:03). -25-Aug 04:03 bacula-dir JobId 356: Job Backup-Chris.2020-08-25_04.00.36_39 waiting 43200 seconds for scheduled start time. -25-Aug 16:03 bacula-dir JobId 356: Start Backup JobId 356, Job=Backup-Chris.2020-08-25_04.00.36_39 -25-Aug 16:03 bacula-dir JobId 356: Using Device "Drive-1-LTO-3" to write. -25-Aug 16:03 ZincFD JobId 356: DIR and FD clocks differ by -5 seconds, FD automatically compensating. -25-Aug 16:04 bacula-iron-sd JobId 356: 3304 Issuing autochanger "load Volume A02106, Slot 12, Drive 1" command. -25-Aug 16:04 bacula-iron-sd JobId 356: 3305 Autochanger "load Volume A02106, Slot 12, Drive 1", status is OK. -25-Aug 16:04 bacula-iron-sd JobId 356: Volume "A02106" previously written, moving to end of data. -25-Aug 16:05 bacula-iron-sd JobId 356: Ready to append to end of Volume "A02106" at file=32. -25-Aug 16:05 bacula-iron-sd JobId 356: Spooling data ... -25-Aug 16:05 bacula-iron-sd JobId 356: Committing spooled data to Volume "A02106". Despooling 787 bytes ... -25-Aug 16:05 bacula-iron-sd JobId 356: Despooling elapsed time = 00:00:01, Transfer rate = 787 Bytes/second -25-Aug 16:05 bacula-iron-sd JobId 356: Elapsed time=00:00:02, Transfer rate=154 Bytes/second -25-Aug 16:05 bacula-iron-sd JobId 356: Sending spooled attrs to the Director. Despooling 406 bytes ... -25-Aug 16:05 bacula-dir JobId 356: Bacula bacula-dir 9.4.2 (04Feb19): - Build OS: x86_64-pc-linux-gnu ubuntu 20.04 - JobId: 356 - Job: Backup-Chris.2020-08-25_04.00.36_39 - Backup Level: Incremental, since=2020-08-22 16:20:07 - 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: 25-Aug-2020 04:00:35 - Start time: 25-Aug-2020 16:03:40 - End time: 25-Aug-2020 16:05:12 - Elapsed time: 1 min 32 secs - Priority: 10 - FD Files Written: 2 - SD Files Written: 2 - FD Bytes Written: 71 (71 B) - SD Bytes Written: 309 (309 B) - Rate: 0.0 KB/s - Software Compression: None - Comm Line Compression: 2.0% 1.0:1 + Comm Line Compression: 3.8% 1.0:1 Snapshot/VSS: no Encryption: no Accurate: no Volume name(s): A02106 - Volume Session Id: 12 - Volume Session Time: 1598344730 - Last Volume Bytes: 112,920,062,976 (112.9 GB) + Volume Session Id: 19 + Volume Session Time: 1599755230 + Last Volume Bytes: 226,742,777,856 (226.7 GB) Non-fatal FD errors: 0 SD Errors: 0 FD termination status: OK SD termination status: OK Termination: Backup OK -25-Aug 16:05 bacula-dir JobId 356: Begin pruning Jobs older than 30 years . -25-Aug 16:05 bacula-dir JobId 356: No Jobs found to prune. -25-Aug 16:05 bacula-dir JobId 356: Begin pruning Files. -25-Aug 16:05 bacula-dir JobId 356: No Files found to prune. -25-Aug 16:05 bacula-dir JobId 356: End auto prune. +22-Sep 02:24 bacula-dir JobId 430: Begin pruning Jobs older than 30 years . +22-Sep 02:24 bacula-dir JobId 430: No Jobs found to prune. +22-Sep 02:24 bacula-dir JobId 430: Begin pruning Files. +22-Sep 02:24 bacula-dir JobId 430: No Files found to prune. +22-Sep 02:24 bacula-dir JobId 430: End auto prune. diff --git a/Dir Config/scripts/webhooks/Christina-Bacula-Mail.md b/Dir Config/scripts/webhooks/Christina-Bacula-Mail.md index f9400ac..8ae90f3 100644 --- a/Dir Config/scripts/webhooks/Christina-Bacula-Mail.md +++ b/Dir Config/scripts/webhooks/Christina-Bacula-Mail.md @@ -1,6 +1,48 @@ -Your data has not yet been backed up! +22-Sep 02:24 bacula-dir JobId 432: Start Backup JobId 432, Job=Backup-Christina.2020-09-22_02.15.00_20 +22-Sep 02:24 bacula-dir JobId 432: Using Device "Drive-0-LTO-3" to write. +22-Sep 02:24 bacula-iron-sd JobId 432: Spooling data ... +22-Sep 02:32 bacula-iron-sd JobId 432: Committing spooled data to Volume "A02106". Despooling 10,218,102 bytes ... +22-Sep 02:32 bacula-iron-sd JobId 432: Despooling elapsed time = 00:00:01, Transfer rate = 10.21 M Bytes/second +22-Sep 02:32 bacula-iron-sd JobId 432: Elapsed time=00:08:07, Transfer rate=20.96 K Bytes/second +22-Sep 02:32 bacula-iron-sd JobId 432: Sending spooled attrs to the Director. Despooling 3,367 bytes ... +22-Sep 02:32 bacula-dir JobId 432: Bacula bacula-dir 9.4.2 (04Feb19): + Build OS: x86_64-pc-linux-gnu ubuntu 20.04 + JobId: 432 + Job: Backup-Christina.2020-09-22_02.15.00_20 + Backup Level: Incremental, since=2020-09-15 02:20:01 + Client: "Zinc-Client" 9.6.3 (09Mar20) amd64-portbld-freebsd11.3,freebsd,11.3-RELEASE-p8 + FileSet: "Christina Backup" 2020-08-25 02:15:00 + Pool: "Incr-Pool" (From Job IncPool override) + Catalog: "MyCatalog" (From Client resource) + Storage: "Iron-Autochanger" (From Pool resource) + Scheduled time: 22-Sep-2020 02:15:00 + Start time: 22-Sep-2020 02:24:44 + End time: 22-Sep-2020 02:32:53 + Elapsed time: 8 mins 9 secs + Priority: 10 + FD Files Written: 16 + SD Files Written: 16 + FD Bytes Written: 10,205,589 (10.20 MB) + SD Bytes Written: 10,207,724 (10.20 MB) + Rate: 20.9 KB/s + Software Compression: 7.6% 1.1:1 + Comm Line Compression: None + Snapshot/VSS: no + Encryption: no + Accurate: no + Volume name(s): A02106 + Volume Session Id: 21 + Volume Session Time: 1599755230 + Last Volume Bytes: 226,753,099,776 (226.7 GB) + Non-fatal FD errors: 0 + SD Errors: 0 + FD termination status: OK + SD termination status: OK + Termination: Backup OK -The bacula daemon will schedule your next backup within the week. -This file will be updated automaticly once your data is on tape. +22-Sep 02:32 bacula-dir JobId 432: Begin pruning Jobs older than 30 years . +22-Sep 02:32 bacula-dir JobId 432: No Jobs found to prune. +22-Sep 02:32 bacula-dir JobId 432: Begin pruning Files. +22-Sep 02:32 bacula-dir JobId 432: No Files found to prune. +22-Sep 02:32 bacula-dir JobId 432: End auto prune. -Contact Joe for questions. diff --git a/Dir Config/scripts/webhooks/Julio-Bacula-Mail.md b/Dir Config/scripts/webhooks/Julio-Bacula-Mail.md index f9400ac..508fda4 100644 --- a/Dir Config/scripts/webhooks/Julio-Bacula-Mail.md +++ b/Dir Config/scripts/webhooks/Julio-Bacula-Mail.md @@ -1,6 +1,48 @@ -Your data has not yet been backed up! +22-Sep 02:30 bacula-dir JobId 433: Start Backup JobId 433, Job=Backup-Julio.2020-09-22_02.15.00_21 +22-Sep 02:30 bacula-dir JobId 433: Using Device "Drive-1-LTO-3" to write. +22-Sep 02:30 bacula-iron-sd JobId 433: Spooling data ... +22-Sep 02:30 bacula-iron-sd JobId 433: Committing spooled data to Volume "PF6866". Despooling 430 bytes ... +22-Sep 02:30 bacula-iron-sd JobId 433: Despooling elapsed time = 00:00:01, Transfer rate = 430 Bytes/second +22-Sep 02:30 bacula-iron-sd JobId 433: Elapsed time=00:00:01, Transfer rate=0 Bytes/second +22-Sep 02:30 bacula-iron-sd JobId 433: Sending spooled attrs to the Director. Despooling 0 bytes ... +22-Sep 02:30 bacula-dir JobId 433: Bacula bacula-dir 9.4.2 (04Feb19): + Build OS: x86_64-pc-linux-gnu ubuntu 20.04 + JobId: 433 + Job: Backup-Julio.2020-09-22_02.15.00_21 + Backup Level: Incremental, since=2020-09-15 02:26:09 + Client: "Zinc-Client" 9.6.3 (09Mar20) amd64-portbld-freebsd11.3,freebsd,11.3-RELEASE-p8 + FileSet: "Julio Backup" 2020-09-01 02:15:00 + Pool: "Incr-Pool" (From Job IncPool override) + Catalog: "MyCatalog" (From Client resource) + Storage: "Iron-Autochanger" (From Pool resource) + Scheduled time: 22-Sep-2020 02:15:00 + Start time: 22-Sep-2020 02:30:44 + End time: 22-Sep-2020 02:30:47 + Elapsed time: 3 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: 22 + Volume Session Time: 1599755230 + Last Volume Bytes: 334,008,428,544 (334.0 GB) + Non-fatal FD errors: 0 + SD Errors: 0 + FD termination status: OK + SD termination status: OK + Termination: Backup O -The bacula daemon will schedule your next backup within the week. -This file will be updated automaticly once your data is on tape. +22-Sep 02:30 bacula-dir JobId 433: Begin pruning Jobs older than 30 years . +22-Sep 02:30 bacula-dir JobId 433: No Jobs found to prune. +22-Sep 02:30 bacula-dir JobId 433: Begin pruning Files. +22-Sep 02:30 bacula-dir JobId 433: No Files found to prune. +22-Sep 02:30 bacula-dir JobId 433: End auto prune. -Contact Joe for questions. diff --git a/Dir Config/scripts/webhooks/NewImprovedBot.py b/Dir Config/scripts/webhooks/NewImprovedBot.py new file mode 100644 index 0000000..49a75a4 --- /dev/null +++ b/Dir Config/scripts/webhooks/NewImprovedBot.py @@ -0,0 +1,12 @@ +from discord_webhook import DiscordWebhook, DiscordEmbed +from bathook import bathook + +webhookURL = "https://discordapp.com/api/webhooks/758548414962073670/RsBq2Tex4_mh7mAu_otYzlabW0mFHkcSxnyW4MNl6hFniagT6EEACEPLB9mtIt76NY81" +maxCharPerMessage = 1994 + +bathook = bathook("/etc/bacula/scripts/webhooks/Aidan-Bacula-Mail.md", "Test") + +for message_part in bathook.get_formatted_message(): # For every message part in the truncated output, run this loop + webhook = DiscordWebhook(url=webhookURL, username="Test Embedded bot!") # Attach the message + webhook.add_embed(bathook.get_discord_embed()) + response = webhook.execute() # Hit send \ No newline at end of file diff --git a/Dir Config/scripts/webhooks/RoboticsMail.md b/Dir Config/scripts/webhooks/RoboticsMail.md index 9f84155..f55c28d 100644 --- a/Dir Config/scripts/webhooks/RoboticsMail.md +++ b/Dir Config/scripts/webhooks/RoboticsMail.md @@ -1,92 +1,48 @@ -25-Aug 02:21 bacula-dir JobId 354: Start Backup JobId 354, Job=Backup-Robotics.2020-08-25_02.15.00_37 -25-Aug 02:21 bacula-dir JobId 354: Using Device "Drive-1-LTO-3" to write. -25-Aug 02:21 bacula-dir JobId 354: Warning: bsockcore.c:201 Could not connect to Client: Zinc-Client on 10.85.3.31:9102. ERR=No route to host -Retrying ... -25-Aug 02:24 bacula-dir JobId 354: Fatal error: bsockcore.c:208 Unable to connect to Client: Zinc-Client on 10.85.3.31:9102. ERR=No route to host -25-Aug 02:24 bacula-dir JobId 354: Fatal error: No Job status returned from FD. -25-Aug 02:24 bacula-dir JobId 354: Error: Bacula bacula-dir 9.4.2 (04Feb19): +22-Sep 02:32 bacula-dir JobId 435: Start Backup JobId 435, Job=Backup-Robotics.2020-09-22_02.15.00_23 +22-Sep 02:32 bacula-dir JobId 435: Using Device "Drive-0-LTO-3" to write. +22-Sep 02:32 bacula-iron-sd JobId 435: Spooling data ... +22-Sep 02:33 bacula-iron-sd JobId 435: Committing spooled data to Volume "A02106". Despooling 50,889 bytes ... +22-Sep 02:33 bacula-iron-sd JobId 435: Despooling elapsed time = 00:00:01, Transfer rate = 50.88 K Bytes/second +22-Sep 02:33 bacula-iron-sd JobId 435: Elapsed time=00:00:08, Transfer rate=6.273 K Bytes/second +22-Sep 02:33 bacula-iron-sd JobId 435: Sending spooled attrs to the Director. Despooling 2,126 bytes ... +22-Sep 02:33 bacula-dir JobId 435: Bacula bacula-dir 9.4.2 (04Feb19): Build OS: x86_64-pc-linux-gnu ubuntu 20.04 - JobId: 354 - Job: Backup-Robotics.2020-08-25_02.15.00_37 - Backup Level: Incremental, since=2020-08-22 16:20:03 + JobId: 435 + Job: Backup-Robotics.2020-09-22_02.15.00_23 + Backup Level: Incremental, since=2020-09-15 02:26:13 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: 25-Aug-2020 02:15:00 - Start time: 25-Aug-2020 02:21:24 - End time: 25-Aug-2020 02:24:24 - Elapsed time: 3 mins + Scheduled time: 22-Sep-2020 02:15:00 + Start time: 22-Sep-2020 02:32:54 + End time: 22-Sep-2020 02:33:04 + Elapsed time: 10 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 + FD Files Written: 10 + SD Files Written: 10 + FD Bytes Written: 48,903 (48.90 KB) + SD Bytes Written: 50,189 (50.18 KB) + Rate: 4.9 KB/s Software Compression: None - Comm Line Compression: None + Comm Line Compression: 6.5% 1.1:1 Snapshot/VSS: no Encryption: no Accurate: no - Volume name(s): - Volume Session Id: 10 - Volume Session Time: 1598315460 - Last Volume Bytes: 6,785,888,256 (6.785 GB) - Non-fatal FD errors: 1 - SD Errors: 0 - FD termination status: Error - SD termination status: Waiting on FD - Termination: *** Backup Error *** - -25-Aug 02:24 bacula-dir JobId 354: Rescheduled Job Backup-Robotics.2020-08-25_02.15.00_37 at 25-Aug-2020 02:24 to re-run in 43200 seconds (25-Aug-2020 14:24). -25-Aug 02:24 bacula-dir JobId 354: Job Backup-Robotics.2020-08-25_02.15.00_37 waiting 43200 seconds for scheduled start time. -25-Aug 14:29 bacula-dir JobId 354: Start Backup JobId 354, Job=Backup-Robotics.2020-08-25_02.15.00_37 -25-Aug 14:29 bacula-dir JobId 354: Using Device "Drive-1-LTO-3" to write. -25-Aug 14:29 ZincFD JobId 354: DIR and FD clocks differ by -4 seconds, FD automatically compensating. -25-Aug 14:29 bacula-iron-sd JobId 354: Spooling data ... -25-Aug 14:29 bacula-iron-sd JobId 354: Committing spooled data to Volume "A02106". Despooling 460 bytes ... -25-Aug 14:29 bacula-iron-sd JobId 354: Despooling elapsed time = 00:00:01, Transfer rate = 460 Bytes/second -25-Aug 14:29 bacula-iron-sd JobId 354: Elapsed time=00:00:06, Transfer rate=0 Bytes/second -25-Aug 14:29 bacula-iron-sd JobId 354: Sending spooled attrs to the Director. Despooling 0 bytes ... -25-Aug 14:29 bacula-dir JobId 354: Bacula bacula-dir 9.4.2 (04Feb19): - Build OS: x86_64-pc-linux-gnu ubuntu 20.04 - JobId: 354 - Job: Backup-Robotics.2020-08-25_02.15.00_37 - Backup Level: Incremental, since=2020-08-22 16:20:03 - 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: 25-Aug-2020 02:15:00 - Start time: 25-Aug-2020 14:29:15 - End time: 25-Aug-2020 14:29:21 - Elapsed time: 6 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: 11 - Volume Session Time: 1598344730 - Last Volume Bytes: 19,791,442,944 (19.79 GB) + Volume name(s): A02106 + Volume Session Id: 24 + Volume Session Time: 1599755230 + Last Volume Bytes: 226,753,164,288 (226.7 GB) Non-fatal FD errors: 0 SD Errors: 0 FD termination status: OK SD termination status: OK Termination: Backup OK -25-Aug 14:29 bacula-dir JobId 354: Begin pruning Jobs older than 30 years . -25-Aug 14:29 bacula-dir JobId 354: No Jobs found to prune. -25-Aug 14:29 bacula-dir JobId 354: Begin pruning Files. -25-Aug 14:29 bacula-dir JobId 354: No Files found to prune. -25-Aug 14:29 bacula-dir JobId 354: End auto prune. +22-Sep 02:33 bacula-dir JobId 435: Begin pruning Jobs older than 30 years . +22-Sep 02:33 bacula-dir JobId 435: No Jobs found to prune. +22-Sep 02:33 bacula-dir JobId 435: Begin pruning Files. +22-Sep 02:33 bacula-dir JobId 435: No Files found to prune. +22-Sep 02:33 bacula-dir JobId 435: End auto prune. diff --git a/Dir Config/scripts/webhooks/__pycache__/bathook.cpython-38.pyc b/Dir Config/scripts/webhooks/__pycache__/bathook.cpython-38.pyc index 38fafcc..e29b3ae 100644 Binary files a/Dir Config/scripts/webhooks/__pycache__/bathook.cpython-38.pyc and b/Dir Config/scripts/webhooks/__pycache__/bathook.cpython-38.pyc differ diff --git a/Dir Config/scripts/webhooks/bathook.py b/Dir Config/scripts/webhooks/bathook.py index 9f36f92..9235be9 100644 --- a/Dir Config/scripts/webhooks/bathook.py +++ b/Dir Config/scripts/webhooks/bathook.py @@ -1,3 +1,4 @@ +from discord_webhook import DiscordEmbed import re @@ -18,7 +19,13 @@ class bathook: self.usedvolumes = self.mextract(self.raw_messages, "Volume name\(s\):") self.jobname = self.mextract(self.raw_messages, "Job:") self.jobid = self.mextract(self.raw_messages, "JobId:") + self.level = self.mextract(self.raw_messages, "Backup Level:") self.data_from = data_from + + if "Backup OK" in self.raw_messages and "Backup OK -- with warnings" not in self.raw_messages: + self.backupstatus = "OK" + else: + self.backupstatus = "Error or warnings." self.maxCharPerMessage = 1994 @@ -33,11 +40,35 @@ class bathook: def get_formatted_message(self): if "Backup OK" in self.raw_messages and "Backup OK -- with warnings" not in self.raw_messages: truncated_stdout = ["""Job {0} (Job {1}) completed with status Backup OK, omitting full report. -All data from {2} was successfully written to tape on {3}. -Backup took {4} And used {5} bytes.""".format(self.jobname, self.jobid, self.data_from, self.endtime, self.elapsedtime, self.byteswritten)] +All data from {2} was successfully written to tape on {3}. Backup level was {4}. +Backup took {5} And used {6} bytes.""".format(self.jobname, self.jobid, self.data_from, self.endtime, self.level, self.elapsedtime, self.byteswritten)] if len(self.usedvolumes) > 1: truncated_stdout[0] = truncated_stdout[0] + ("\nWrote data to volume(s) {0} {1}".format(self.usedvolumes, self.rescheduled)) else: # Discord limits each message to 2000 chars, if the message is longer than that, truncate it - truncated_stdout = [cleaned_stdout[i:i+self.maxCharPerMessage] for i in range(0, len(cleaned_stdout), self.maxCharPerMessage)] - return(truncated_stdout) \ No newline at end of file + truncated_stdout = [self.raw_messages[i:i+self.maxCharPerMessage] for i in range(0, len(self.raw_messages), self.maxCharPerMessage)] + return(truncated_stdout) + + def get_discord_embed(self): + if self.backupstatus == "OK": + headercolor = 3388189 + headerdesc = "The most recent backup completed with status OK, and so the full report will not be shown." + else: + headercolor = 10358814 + headerdesc = "The most recent backup did not complete, or completed with errors, the fill report will still not be shown." + + self.embed = DiscordEmbed(title="Tape Job Results", description=headerdesc, color=headercolor) + self.embed.set_author(name="Snowsune's Tape Daemon", url="https://kitsunehosting.net/", icon_url="https://kitsunehosting.net/nextcloud/index.php/apps/files_sharing/publicpreview/zzygHFxJQXjXxMz?x=1920&y=553&a=true&file=TapeImage.JPG&scalingup=0") + self.embed.set_timestamp() + self.embed.add_embed_field(name="End Time", value=self.endtime) + self.embed.add_embed_field(name="Elapsed Time", value=self.elapsedtime) + self.embed.add_embed_field(name="Bytes Written", value=self.byteswritten) + if len(self.usedvolumes) > 0: + self.embed.add_embed_field(name="Used Volumes", value=self.usedvolumes) + self.embed.add_embed_field(name="Job Name", value=self.jobname) + self.embed.add_embed_field(name="Job ID", value=self.jobid) + self.embed.add_embed_field(name="Job Level", value=self.level) + if len(self.rescheduled) > 0: + self.embed.add_embed_field(name="Job Reschedule?", value=self.rescheduled) + + return(self.embed) \ No newline at end of file