Backup Job notifcation - identify the job by name/ID/comment

May 17, 2022
10
1
8
I want to automate the monitoring of my monitoring jobs. I am pushing the notifications via a webhook to a ntfy.sh system and am parsing the title to match the desired icinga service for the backup.

If a PVE system has multiple backup jobs to run every day, I don't see a "unique" identifier to know which job was run. e.g. by using the comment provided in the backup job comment field or by some other unique identifier. in the notification, neither in the webhook nor in the email, I see a way to "identify" which of the jobs has been run.

Am I missing something? How are others solving that in their monitoring system? Are you parsing the notifications for the individual result of each VM to solve that problem?

thanks for any ideas
KoS
 
You can try adding a special prefix (e.g. JOBID: daily_db) to the Comment field of the PVE backup job. This trick allows the notification title to carry the identifier:
For example: Backup finished: JOBID:daily_db (VM 100)
For precise tracking, maybe you can use the PVE API real-time verification + Webhook combination.
 
Thanks @Magnus-mercer
For me the comment does not appear in the backup notification mail. e.g. the subject is always in the form "vzdump backup status (HOSTNAME): backup successful" and the body has a "Details" section with the VMs listed and a "Logs" section with the details, but the comment from the job is nowhere included.
Does for you the comment appear in the job notification?
 
This trick allows the notification title to carry the identifier:
but the comment from the job is nowhere included.
AFAIK (& experience) neither of you are right.

The comment added to the backup job will appear (buried) in the notification body in the vzdump command at the beginning of the Logs section in the form of something like this:

Code:
Logs
vzdump <vmid> --remove <integer> --node <node> --mode <mode> --notification-mode <mode>--notes-template '{{guestname}}<comment>' --compress <str> --storage <storage>
with <comment> being what you are looking for.
 
Thanks @gfngfn256
Unfortunately for me it doesn't appear in the Logs:
Code:
vzdump 104 --fleecing 0 --all 0 --compress zstd --notification-mode notification-system --notes-template '{{guestname}}' --node pve02 --storage pbs-nfs --mode stop
Maybe wer are not taking about the same thing or I am looking at the wrong config option?
-> Datacenter -> Backup -> Edit Backup Job -> "Job Comment" -> this comment does not appear in the Logs section.
Do I need to modify some kind of notification template or so?
 
Maybe wer are not taking about the same thing
I reread your issue, & you are definitely right! I was referring to the notes attached to a VM, not the comment/notes attached on a backup job. Sorry.
 
okay thanks.
so I will most likely write a script to parse the information out of the emails, as I didn't find a way to get the information about backups from the API.
I am surprise that Proxmox doesn't provide a way to get the required information to monitor if the backups are fine. :-(
 
okay thanks.
so I will most likely write a script to parse the information out of the emails, as I didn't find a way to get the information about backups from the API.
I am surprise that Proxmox doesn't provide a way to get the required information to monitor if the backups are fine. :-(
Hi, the other day I made a script that takes information from backups using several methods, including API, and sends reports to Telegram, take a look at it, maybe it will help you

https://github.com/FeliksMarello/proxmox-backup-notifier
 
  • Like
Reactions: kos
thanks for any ideas
parse the information out of the emails
Possible workaround:

In -> Datacenter -> Backup -> Edit Backup Job -> Note Template -> this comment will be added to the notes of the backup & will appear in the Logs section of the notification (beginning) as:
Code:
Logs
vzdump <vmid> --notes-template '{{guestname}} <above note template you added>' ..........................

This way each backup job will be easily identifiable, both in the backup itself, & in the notification body which should be parsable by you for your use-case.
 
  • Like
Reactions: kos