Do you ever wonder if your backup software is backing up all your virtual machines? Perhaps you missed a folder or a production VM has been placed in a folder excluded from backups.
I’ve created a dashboard that shows you which of your virtual machines are getting backed up by your backup software and which are not.
Note that while it can be adapted, these dashboards will not show the backup status of your virtual machines, however, if your backup software takes snapshots of virtual machines it will tell you which virtual machines the backup software is intending to backup. From this data, we can identify the virtual machines which are not touched by your backup software and investigate from there.
- Your backup software needs to be taking snapshots of virtual machines for this to work. This is because the script provided below will scan virtual machine events, looking for snapshot operations. If it finds one, it will add the date and time of the snapshot creation task (if created by your backup service account user) to a property against the virtual machine in vROps.
- Your backup solution needs to be logging into vCenter Server with a dedicated service account, this account cannot be shared with other systems or users.
- You need to be running vROps Advanced or Enterprise to import and modify these customer dashboards.
- You should create a new vROps and vCenter account for the script to log in to the respective systems. The vROps account will need modify permissions to your virtual machine objects. The vCenter account can be read-only on all virtual machines.
You can download the script from GitHub here https://github.com/VirtualgUK/vROps-Dashboards/blob/main/VM%20Backup%20Snapshots%20vROps%20Dashboard.zip
Once downloaded, edit the variables in the script as commented.
Read through the full script as there are a bunch of variables that you can change.
A note on security. The script has plaintext credentials listed within, this is to test the script is working. I do not suggest you leave the script like this. Please encrypt your credentials, or better make a call to your password manager for the credentials securely.
If you do not have PowerCLI already installed:
Install-Module -Name VMware.PowerCLI
And if running in a lab, optionally:
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore Set-ExecutionPolicy Unrestricted
Create a scheduled task
- Create a new scheduled task on a system with PowerCLI installed:
- Specify how frequently the task should run, I recommend daily for most environments.
- Specify the start time for the task, you should set this to after your backups complete
- For the action, select start a program
- For the program set: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
- For the arguments you can use something similar to: -ExecutionPolicy Bypass -File “C:\Scripts\vrops-vm-backup-properties.ps1”
- Save the task and go back in to edit it.
- Ensure the script will run regardless if the user is logged in or not.
Specify the user account password when prompted.
Test the script
The next thing to do is to run the script. Rather than waiting for the scheduler to do this for you, right-click the task in task scheduler and select Run.
After a few minutes, (depending on the variables set within the script and the size of your environment) the script should complete.
If it does not, run the script in Powershell ISE or similar and review the Powershell output for any issues to resolve.
Review the data in vROps
If everything has gone well, you should see a new property within vROps.
- Login to vROps and search for a virtual machine that is backed up.
- Go to metrics and expand the Properties section
- Locate the Backup > LastBackupSnapshot property
- Double click this property to add it to the right pane
As the VM keeps getting backed up and the script runs, you’ll start to see additional data points:
The vROps Dashboard
Unzip the files from GitHub, there will be a view.zip and dashboard.zip file, do not unzip these unless you are inspecting the files.
- Within vROps navigate to Dashboards > Views > Manage Views > Import
- Browse to the view.zip file and import it
- Next, navigate to Dashboards > Manage Dashboards > Import
- Browse for the dashboard zip archive and import this too.
- Now, under the Dashboard list, you should see the VM Backup Snapshots dashboard, feel free to edit the dashboard and share any improvements you make.
From the dashboard, you can easily use the ascending and descending ordering options on the headings to see which VMs have snapshots created by the backup solution and when the last one was taken:
You could get inventive and create a symptom and alert based off the new property, be sure to test before relying on the alert.
Also, if you want a more accurate approach, you could always customise the script to hook into your backup solution’s API. This way you could get backup success status and other information from your backup solution into vROps.
I hope this helps!
Be sure to sign up to the mailing list to be notified of updates to this and other useful tools and solutions.