Audit log your Virtual Machine backups using the MyCloudSpace API

As a service provider we handle all of the systems relating to protection of your virtual machines. If something breaks, we fix it. If the jobs had an error we make sure they run on time to meet our SLA we have with you.

We use Veeam internally for all of our Backup and Replication work which has been a very stable workhorse for many years and in recent years we have even transitioned our tape backups to also be managed by Veeam.

Thankfully Veeam have a wonderful set of API's we can tap into and present the data to you in MyCloudSpace which we have done so for years via the Backup tab in the portal as seen below;

What if you have an internal requirement to make sure you can report on when your VMs are being protected and alert you if one is missing or if there was a warning on a job that has guest processing enabled (such as expired credentials.)

You can do this today with the existing MyCloudSpace API and below I have put together a sample script which you can build off - such as logging the data to a database, exception reporting/alerting etc.

How it works

  • Logs in with your API key (let us know if you need one)
  • Grabs your backup session history, as seen on the backups section of MyCloudSpace
  • Gives you an overall status (success, warning, failed or even running) as well as the time started and ended so you can see when your assets were protected
  • Then loops through what virtual machines were protected in this job and gives you similar start/end and duration details for each of them so you can see exactly what time your restore point will be from

Example output

  • Red lines are the "jobs", the green bits under that are the job start/stop and duration stats
  • The blue lines are the virtual machine within the job (red line)
  • Yellow line is the duration of the VM within that job

There we have it, with a few lines of code you can see how powerful this would be if you need to capture (and even act) on this information.

How to run it

You can view the file on our Github repository, copy it or clone the repository, then fill in your API key, Email address and log path.

View BackupReport.ps1

Then run it from a Powershell terminal with

./BackupReport.ps1