API for backup checking

Tacioandrade

Renowned Member
Sep 14, 2012
120
17
83
Vitória da Conquista, Brazil
Good afternoon everyone and happy new year! I've been suffering a bit to get backup information from Proxmox VMs for monitoring in Zabbix! Previously I used one from Zabbix Share, but it is no longer viable for me, since we also implemented the Proxmox Backup Server in our infrastructures.

Today I am looking for a way to monitor Proxmox backups and would like to know from the PVE development team if there is any hope that in the next few months an API call will be added to PVE that returns:

* Which VMs or at least if there are VMs that still need to configure the backup in a cluster (today already appears in the Proxmox web interface under Datacenter => Backup the message: "Some guests are not covered by any backup job.")
* Whether the backup job ran with success or error

I believe that the first is the simplest to deliver, because if you already have the call in the web interface, the API already exists, you just need to pass the call used to show the message.

As for the information about backups, I don't know if it already exists, but any tip would be very useful.

Thanks also to any friend who has successfully deployed a Proxmox VM Backup template (with PBS support) to Zabbix and who delivers this data and can share it!
 
I'm trying while I can't find the solution to catch, at least if some backup in the last 24h gave an error, however using the option -since <timestamp> seems to give an error.

Anyone who has used this option would know how to tell me how I can get the logs only from the last 24 hours? To get the timestamp of the day before I got it with the command:

# date -d "-1 day" +%s

The problem is that when I try to use the -since option in pvesh it gives error 400:

# pvesh get /nodes/`cat /etc/hostname`/tasks/ -typefilter vzdump -since `date -d "-1 day" +%s`
Unknown option: since
400 unable to parse option
pvesh get <api_path> [OPTIONS] [FORMAT_OPTIONS]
 
Hi,
Good afternoon everyone and happy new year! I've been suffering a bit to get backup information from Proxmox VMs for monitoring in Zabbix! Previously I used one from Zabbix Share, but it is no longer viable for me, since we also implemented the Proxmox Backup Server in our infrastructures.

Today I am looking for a way to monitor Proxmox backups and would like to know from the PVE development team if there is any hope that in the next few months an API call will be added to PVE that returns:

* Which VMs or at least if there are VMs that still need to configure the backup in a cluster (today already appears in the Proxmox web interface under Datacenter => Backup the message: "Some guests are not covered by any backup job.")
* Whether the backup job ran with success or error

I believe that the first is the simplest to deliver, because if you already have the call in the web interface, the API already exists, you just need to pass the call used to show the message.
the information can be obtained with pvesh get /cluster/backup-info/not-backed-up.
The problem is that when I try to use the -since option in pvesh it gives error 400:

# pvesh get /nodes/`cat /etc/hostname`/tasks/ -typefilter vzdump -since `date -d "-1 day" +%s`
Unknown option: since
400 unable to parse option
pvesh get <api_path> [OPTIONS] [FORMAT_OPTIONS]
The option is only available in pve-manager >= 7.0-5. Are you running a new enough version?
 
Hello,
I am interested too in this thread. I have written also in this thread: https://forum.proxmox.com/posts/433931/
In the backup email that proxmox sends even in "old" versions (5, 6...) there are all informations you need to put in a monitoring solution like zabbix or nagios.
Unfortunately:
- it is a email
- it is not a machine readable format (ok there are regular expressions but you increase a risk of error)

Which API I need to get the same information that proxmox uses to build that mail?

Can I backport new pvesh in old proxmox?

Thanks,
Mario
 
Hi,
Hello,
I am interested too in this thread. I have written also in this thread: https://forum.proxmox.com/posts/433931/
In the backup email that proxmox sends even in "old" versions (5, 6...) there are all informations you need to put in a monitoring solution like zabbix or nagios.
Unfortunately:
- it is a email
- it is not a machine readable format (ok there are regular expressions but you increase a risk of error)
What information do you need exactly? If you just want to catch failing backups, easiest might be to check the statuses of the tasks returned by the tasks API endpoint.

Which API I need to get the same information that proxmox uses to build that mail?
I don't think that information is not saved anywhere separately. Once you have the UPID, you can do
Code:
pvesh get /nodes/pve701/tasks/UPID:pve701:000069DE:0004DB5B:61DD7BCC:vzdump:106:root@pam:/status
pvesh get /nodes/pve701/tasks/UPID:pve701:000069DE:0004DB5B:61DD7BCC:vzdump:106:root@pam:/log --noborder --noheader
but parsing the log is not much better than parsing an email I'd say.

Can I backport new pvesh in old proxmox?
You are free to try, the commit introducing the --since feature is here. But filtering the output of pvesh with a script should also be easy enough. Also see the noborder/noheader and output-format options (man pvesh).

Thanks,
Mario
 
Hi,

What information do you need exactly? If you just want to catch failing backups, easiest might be to check the statuses of the tasks returned by the tasks API endpoint.


I don't think that information is not saved anywhere separately. Once you have the UPID, you can do
I need that:
Screenshot_20220112_121834.png

And I suppose many people need this. If you want to monitor several proxmox installations using zabbix or nagios and you want a graph of backup duration and a trigger failed/ok.


You are free to try, the commit introducing the --since feature is here. But filtering the output of pvesh with a script should also be easy enough. Also see the noborder/noheader and output-format options (man pvesh).
Sorry I meant: can YOU officially backport new features of pvesh in old proxmoxs?
 
I need that:
View attachment 33187

And I suppose many people need this. If you want to monitor several proxmox installations using zabbix or nagios and you want a graph of backup duration and a trigger failed/ok.
Unfortunately, that is only generated during the job and not saved anywhere. Maybe you can use a backup hookscript to get hold of (at least some of) that information, see /usr/share/doc/pve-manager/examples/vzdump-hook-script.pl for an example.

Sorry I meant: can YOU officially backport new features of pvesh in old proxmoxs?
New features are usually not backported, except if there is a good reason for it.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!