REST API knowledge exchange
Post Reply
sumeet
Service Provider
Posts: 197
Liked: 31 times
Joined: Apr 23, 2021 6:40 am
Full Name: Sumeet P
Contact:

Scripts to use REST API to monitor job and sessions

Post by sumeet »

Hi,

We have had scenarios where in the backup jobs fail over night and are unable to catch that in our monitoring (PRTG) system to be able to act on it during the night (instead of checking on the morning and then discuss with client about the failure - also during the day, most are not willing to run the backups).

For M365 I have used REST API in script to monitor the jobs, the sessions and duration of the job and many parameters that easily helps us integrate the output in PRTG.

Since morning, I have been playing with swagger on a test VBR server and see the APIs to get job states and job details.

I was hoping if there are already scripts available that I can use and build upon, instead of having to write this from scratch.

Currently we have scripts that are used on PRTG which integrate with NetBackup ops center server, to monitor the backup job activity and the sensor goes red if there are more than 15 or 20 failures in the last 20mins. If couple of VM backups fail it is ok and can be looked into the next day morning, but if there are mass failures (like a client updated certificates on their vCenter and missed informing us), in such a case, all the VBR backup jobs and all VMs in the jobs will fail. We want to be able to catch such scenarios which have to be acted upon when they are detected (which is after hours). Such important sensors in PRTG then get highlighted and notification triggers a call, which allows us to act on it.

Any pointers will be hepful.

Thanks,
-Sumeet.
david.domask
Veeam Software
Posts: 2607
Liked: 610 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Scripts to use REST API to monitor job and sessions

Post by david.domask »

Hi Sumeet,

I'm not aware of any script repositories for the REST API off the top of my head with such a script specifically, but I would suggest try the forum search for the endpoints you're working with for some examples.

You may want to start with the Reports endpoint as you can receive the reports as shown in Enterprise Manager dashboard; if you need to do more specific session reporting than that, start with working on the /backupSession endpoint and /backupTaskSessions endpoints.

We do have a collection of Collections for Postman which can help with your script design.
David Domask | Product Management: Principal Analyst
rennerstefan
Veeam Software
Posts: 725
Liked: 161 times
Joined: Jan 22, 2015 2:39 pm
Full Name: Stefan Renner
Location: Germany
Contact:

Re: Scripts to use REST API to monitor job and sessions

Post by rennerstefan »

I guess what you are looking for is part of the REST endpoint: "/api/v1/sessions"
https://helpcenter.veeam.com/docs/backu ... llSessions

It allows you to parse all sessions running within VBR and get their results.
That way, you can easily understand what failed or had warnings within PRTG.

Btw. I also recommend that you reach out to PRTG to enhance the current integration. As I also recently talked to them, I think there might be a good chance to get some more data into PRTG out of the box.
Stefan Renner

Veeam PMA
jorgedlcruz
Veeam Software
Posts: 1551
Liked: 669 times
Joined: Jul 17, 2015 6:54 pm
Full Name: Jorge de la Cruz
Contact:

Re: Scripts to use REST API to monitor job and sessions

Post by jorgedlcruz »

Hello,
I wrote this using VBR API, and it currently is running on thousands of environments, if numbers from Grafana are right: The script used can be found here, and of course there is a section just for jobs, etc.

Take a look, as I am sure it might have many of the information you need. From here, you can convert it to PowerShell perhaps, and the output to PRTG format.

Let us know!
Jorge de la Cruz
Senior Product Manager | Veeam ONE @ Veeam Software

@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
sumeet
Service Provider
Posts: 197
Liked: 31 times
Joined: Apr 23, 2021 6:40 am
Full Name: Sumeet P
Contact:

Re: Scripts to use REST API to monitor job and sessions

Post by sumeet »

Apologies for my delayed reply. I will go through the information shared and check if I can setup sensors.

Will get back on this how I go - as it always happens - other work gets prioritized.

Thanks for all the inputs.

Thanks,
-Sumeet.
Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests