Save again
This commit is contained in:
parent
bcc8d29ebf
commit
4c3d652a58
Binary file not shown.
After Width: | Height: | Size: 476 KiB |
|
@ -1,20 +1,31 @@
|
|||
from discord_webhook import DiscordWebhook
|
||||
import subprocess
|
||||
|
||||
cameraURL = "rtsp://10.85.3.33:554/11"
|
||||
webhookURL = "https://discordapp.com/api/webhooks/719690867811811348/8LExCQbqOPP0XAdNcbV8JHrVYupOSYmeLwkBJWCDCe72JoPyc4Yy_R2wzbkKSN33MPAn"
|
||||
maxCharPerMessage = 1994
|
||||
|
||||
out = subprocess.Popen(['echo messages | bconsole'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
shell=True)
|
||||
#out = subprocess.Popen(['cat /etc/bacula/scripts/test.md'],
|
||||
out = subprocess.Popen(['echo messages | bconsole'], # Use this command to get the messages out of bconsole
|
||||
stdout=subprocess.PIPE, # Save the output
|
||||
stderr=subprocess.STDOUT, # Save the output
|
||||
shell=True) # This is a already formatted shell command
|
||||
|
||||
stdout,stderr = out.communicate()
|
||||
print(stdout)
|
||||
print(stderr)
|
||||
cleaned_stdout = b"```" + stdout.partition(b"\nmessages\n")[2] + b"```"
|
||||
stdout,stderr = out.communicate() # Extract the outputs
|
||||
#print(stdout) # Print the output
|
||||
print(stderr) # Print any errors
|
||||
|
||||
if (cleaned_stdout != b'```You have no messages.\n```'):
|
||||
webhook = DiscordWebhook(url=webhookURL, content=cleaned_stdout)
|
||||
cleaned_stdout = stdout.partition(b"\nmessages\n")[2] + b"" # Trim the messages by removing timestamp and connection info
|
||||
print(cleaned_stdout) # Print the cleaned output
|
||||
|
||||
# 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
|
||||
|
||||
if (truncated_stdout[0] != b'You have no messages.\n'): # If the first part of the truncated message is empty (no messages) dont send it.
|
||||
for message_part in truncated_stdout: # For every message part in the truncated output, run this loop
|
||||
message_part = b"```" + message_part + b"```"
|
||||
webhook = DiscordWebhook(url=webhookURL, content=message_part) # Send the output to the webhook URL
|
||||
response = webhook.execute()
|
||||
else:
|
||||
print("Done.")
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
Connecting to Director 10.85.3.30:9101
|
||||
1000 OK: 103 bacula-dir Version: 9.4.2 (04 February 2019)
|
||||
Enter a period to cancel a command.
|
||||
messages
|
||||
07-Jun 11:15 bacula-dir JobId 97: No prior Full backup Job record found.
|
||||
07-Jun 11:15 bacula-dir JobId 97: No prior or suitable Full backup found in catalog. Doing FULL backup.
|
||||
07-Jun 11:15 bacula-dir JobId 97: Start Backup JobId 97, Job=Backup-Mark.2020-06-07_11.15.04_52
|
||||
07-Jun 11:15 bacula-dir JobId 97: Using Device "Drive-0-LTO-3" to write.
|
||||
07-Jun 11:15 temp-iron-sd JobId 97: 3304 Issuing autochanger "load Volume A00572, Slot 17, Drive 0" command.
|
||||
07-Jun 11:15 temp-iron-sd JobId 97: 3305 Autochanger "load Volume A00572, Slot 17, Drive 0", status is OK.
|
||||
07-Jun 11:15 temp-iron-sd JobId 97: Volume "A00572" previously written, moving to end of data.
|
||||
07-Jun 11:17 temp-iron-sd JobId 97: Warning: For Volume "A00572":
|
||||
The number of files mismatch! Volume=37 Catalog=36
|
||||
Correcting Catalog
|
||||
07-Jun 14:14 temp-iron-sd JobId 97: [SI0202] End of Volume "A00572" at 105:58664 on device "Drive-0-LTO-3" (/dev/nst0). Write of 64512 bytes got -1.
|
||||
07-Jun 14:14 temp-iron-sd JobId 97: Re-read of last block succeeded.
|
||||
07-Jun 14:14 temp-iron-sd JobId 97: End of medium on Volume "A00572" Bytes=419,778,035,712 Blocks=4,274,868 at 07-Jun-2020 18:14.
|
||||
07-Jun 14:14 temp-iron-sd JobId 97: 3307 Issuing autochanger "unload Volume A00572, Slot 17, Drive 0" command.
|
||||
07-Jun 14:15 bacula-dir JobId 97: Using Volume "A02057" from 'Scratch' pool.
|
||||
07-Jun 14:15 temp-iron-sd JobId 97: 3304 Issuing autochanger "load Volume A02057, Slot 15, Drive 0" command.
|
||||
07-Jun 14:16 temp-iron-sd JobId 97: 3305 Autochanger "load Volume A02057, Slot 15, Drive 0", status is OK.
|
||||
07-Jun 14:16 temp-iron-sd JobId 97: Wrote label to prelabeled Volume "A02057" on Tape device "Drive-0-LTO-3" (/dev/nst0)
|
||||
07-Jun 14:16 temp-iron-sd JobId 97: New volume "A02057" mounted on device "Drive-0-LTO-3" (/dev/nst0) at 07-Jun-2020 18:16.
|
||||
07-Jun 18:42 temp-iron-sd JobId 97: [SI0202] End of Volume "A02057" at 104:54117 on device "Drive-0-LTO-3" (/dev/nst0). Write of 64512 bytes got -1.
|
||||
07-Jun 18:42 temp-iron-sd JobId 97: Re-read of last block succeeded.
|
||||
07-Jun 18:42 temp-iron-sd JobId 97: End of medium on Volume "A02057" Bytes=419,484,699,648 Blocks=6,502,428 at 07-Jun-2020 22:42.
|
||||
07-Jun 18:42 temp-iron-sd JobId 97: 3307 Issuing autochanger "unload Volume A02057, Slot 15, Drive 0" command.
|
||||
07-Jun 18:43 bacula-dir JobId 97: Using Volume "A01099" from 'Scratch' pool.
|
||||
07-Jun 18:43 temp-iron-sd JobId 97: 3304 Issuing autochanger "load Volume A01099, Slot 4, Drive 0" command.
|
||||
07-Jun 18:44 temp-iron-sd JobId 97: 3305 Autochanger "load Volume A01099, Slot 4, Drive 0", status is OK.
|
||||
07-Jun 18:44 temp-iron-sd JobId 97: Wrote label to prelabeled Volume "A01099" on Tape device "Drive-0-LTO-3" (/dev/nst0)
|
||||
07-Jun 18:44 temp-iron-sd JobId 97: New volume "A01099" mounted on device "Drive-0-LTO-3" (/dev/nst0) at 07-Jun-2020 22:44.
|
||||
07-Jun 23:35 temp-iron-sd JobId 97: [SI0202] End of Volume "A01099" at 105:44015 on device "Drive-0-LTO-3" (/dev/nst0). Write of 64512 bytes got -1.
|
||||
07-Jun 23:35 temp-iron-sd JobId 97: Re-read of last block succeeded.
|
||||
07-Jun 23:35 temp-iron-sd JobId 97: End of medium on Volume "A01099" Bytes=422,832,936,960 Blocks=6,554,329 at 08-Jun-2020 03:35.
|
||||
07-Jun 23:35 temp-iron-sd JobId 97: 3307 Issuing autochanger "unload Volume A01099, Slot 4, Drive 0" command.
|
||||
07-Jun 23:36 bacula-dir JobId 97: Using Volume "A02218" from 'Scratch' pool.
|
||||
07-Jun 23:37 temp-iron-sd JobId 97: 3304 Issuing autochanger "load Volume A02218, Slot 3, Drive 0" command.
|
||||
07-Jun 23:37 temp-iron-sd JobId 97: 3305 Autochanger "load Volume A02218, Slot 3, Drive 0", status is OK.
|
||||
07-Jun 23:37 temp-iron-sd JobId 97: Wrote label to prelabeled Volume "A02218" on Tape device "Drive-0-LTO-3" (/dev/nst0)
|
||||
07-Jun 23:37 temp-iron-sd JobId 97: New volume "A02218" mounted on device "Drive-0-LTO-3" (/dev/nst0) at 08-Jun-2020 03:37.
|
||||
08-Jun 03:48 temp-iron-sd JobId 97: Elapsed time=16:25:53, Transfer rate=24.92 M Bytes/second
|
||||
08-Jun 03:48 temp-iron-sd JobId 97: Sending spooled attrs to the Director. Despooling 13,762,121 bytes ...
|
||||
08-Jun 03:48 bacula-dir JobId 97: Bacula bacula-dir 9.4.2 (04Feb19):
|
||||
Build OS: x86_64-pc-linux-gnu ubuntu 20.04
|
||||
JobId: 97
|
||||
Job: Backup-Mark.2020-06-07_11.15.04_52
|
||||
Backup Level: Full (upgraded from Incremental)
|
||||
Client: "Zinc-Client" 9.6.3 (09Mar20) amd64-portbld-freebsd11.3,freebsd,11.3-RELEASE-p8
|
||||
FileSet: "Mark Backup" 2020-06-07 02:15:00
|
||||
Pool: "Full-Pool" (From Job FullPool override)
|
||||
Catalog: "MyCatalog" (From Client resource)
|
||||
Storage: "Iron-Autochanger" (From Pool resource)
|
||||
Scheduled time: 07-Jun-2020 11:15:04
|
||||
Start time: 07-Jun-2020 11:15:06
|
||||
End time: 08-Jun-2020 03:48:44
|
||||
Elapsed time: 16 hours 33 mins 38 secs
|
||||
Priority: 10
|
||||
FD Files Written: 48,482
|
||||
SD Files Written: 48,482
|
||||
FD Bytes Written: 1,474,531,659,803 (1.474 TB)
|
||||
SD Bytes Written: 1,474,540,412,469 (1.474 TB)
|
||||
Rate: 24733.0 KB/s
|
||||
Software Compression: 2.0% 1.0:1
|
||||
Comm Line Compression: 2.1% 1.0:1
|
||||
Snapshot/VSS: no
|
||||
Encryption: no
|
||||
Accurate: no
|
||||
Volume name(s): A00572|A02057|A01099|A02218
|
||||
Volume Session Id: 25
|
||||
Volume Session Time: 1591127400
|
||||
Last Volume Bytes: 357,543,051,264 (357.5 GB)
|
||||
Non-fatal FD errors: 0
|
||||
SD Errors: 0
|
||||
FD termination status: OK
|
||||
SD termination status: OK
|
||||
Termination: Backup OK
|
||||
|
||||
08-Jun 03:48 bacula-dir JobId 97: Begin pruning Jobs older than 30 years .
|
||||
08-Jun 03:48 bacula-dir JobId 97: No Jobs found to prune.
|
||||
08-Jun 03:48 bacula-dir JobId 97: Begin pruning Files.
|
||||
08-Jun 03:48 bacula-dir JobId 97: No Files found to prune.
|
||||
08-Jun 03:48 bacula-dir JobId 97: End auto prune.
|
Loading…
Reference in New Issue