Greetings everyone, I have demonstrated to you before the beauty, and use that is to get real-time visibility of the Veeam Backup for Azure, using Grafana. And not that long ago, I have as well gone and step forward and created a Detailed Daily HTML Report for all the workloads that you are protecting in Azure.
Today I wanted to show to you a truly simple way of getting a comfortable CSV (Comma Separated Values) file of your Job Sessions, so you can parse it to your taste, produce beautiful Excel Spreadsheets, and even sometimes include this file into some sort of application that does the parsing to you, of course in the case that you want to automate this, will show you today how to get it from the RESTful API.
How to Obtain the Job Sessions History in CSV/XML from the GUI
Ok, so the procedure could not be easier, as the Product Managers at Veeam had thought about it, from our Veeam Backup for Microsoft Azure Console, we go to Sessions Log:
How to Obtain the Job Sessions History in CSV/XML from RESTful API
Alright, the GUI method is simple enough, but what about if you want to automate this somehow, and obtain a CSV every 24 hours, or something like that. For that, I will truly recommend to use the Veeam Backup for Azure RESTful API.
The specific call to run the export of the Job Sessions can be officially found here:
Great news, I am always happy to find the API calls we need, properly documented, so let’s put them in practice, shall we? As you remember, any API call to Veeam Backup for Azure, it will require a Bearer Token, so you will need to obtain one running the next:
curl -X POST "https://YOURVBAIP/api/oauth2/token" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "Username=YOURVBAUSER&Password=YOURVBAPASSWORD"
This will give you a very long Bearer Token, grab that, and have it ready for the next API call:
After you have that token, you can now run any API call, but in this case, you want to CSV, right. And I guess you are in a Linux environment, so the final call will look something like this:
curl -X POST "https://YOURVBAIP/api/v2/jobSessions/export" -H "accept: text/csv" -H "Authorization: Bearer YOURBEARER" -d "" >> YOURJOBEXPORT.csv
This will generate a file called YOURJOBEXPORT.CSV, on the path you are running the line, if you want to change that, just add the path to the command. And with this, you can take that CSV, and start doing all the work you need, you can do your magic on Excel, like for example converting it to a table:
I hope this is a simple way of getting job sessions and do some stuff with that information. Remember that if you are looking to obtain a Detailed Daily HTML Report you can follow this link, and to get a proper Dashboarding with a lot of information in real-time, you can follow this other link.