Use PRTG to monitor Azure Backup status (updated 07-2022)
Recently I received the question if it is possible to monitor Azure Backup with PRTG. Now this might seem to be a bit weird, as we could use Azure monitoring. But in this case, it was a service provider that needed a single solution for all their services, including custom dashboards and monitoring.
So, challenge accepted, lets get this done! In this case the customer has a Azure Recovery Service Vault with 2 virtual machines, with a backup schedule of only once every 24 hours with a retention of 30 days.
Our goal will be to have 3 sensors in PRTG with the completed jobs, failed jobs and running jobs. If you follow the next steps you should be able to set this up your self as well.
Step 1: Create and application registration in the Azure Portal, so go to Azure Active Directory, and fill in all the required fields. Note, the Redirect URL may be completely random, but it is nice to set it to your PRTG monitoring URL. In this example its just a random address.
Step 2: Go to your created application, and go to overview. Copy the Application ID and Tenant ID to a notepad or something, we will need them later.
Step 3: Go to certificates & secrets, and create a new client secret. Make sure that you save the secret, you will not be able to read it again! You can only create a new key.
Step 4: Now go to the service recovery vault where you want to read the backups from, and assign the PRTG application the Backup Reader role. Also make sure that the account has read permissions on the subscription level!
Step 5: On your PRTG (Probe) server install the AzureRM Module using the following command:
Step 6: On your PRTG (Probe) server, we will need to create a little powershell script, and save it on the following location: C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\AzureBackupStatus.ps1
Step 7: The final step, go into your PRTG environment, and create a new sensor on the device where you’ve added the powershell script. Search for the EXE sensor, and create the EXE/Script Advanced Sensor.
Next step is to configure the sensor properly with the following settings:
- Sensor Name: Set it to whatever you like 🙂
- EXE/Script: AzureBackupStatus.ps1
- Parameters: -password ‘<secretvalue>’ -applicationid ‘<applicationid>’ -TenantId ‘<tenantid>’
Make sure that the entries from the previous steps are added between the ”. When finished click create.
The last step is to change the interval in PRTG. Change it to something smart for your environment. I would recommend max once every hour. The result will look like this:
What if it doesn’t work?
I’ve received a lot of questions and comments that it doesn’t work. The reason that it might not work is because of wrong parameters. To test it and see which part is wrong, log in to your PRTG Probe machine using PRTG, and adjust the script a little bit, and run it with the logged on user.
$password = “<secretvalue>”
$applicationid = “<applicationid>”
$TenantId = “<tenantid>”
The result should look like this:
If there is something wrong, you will get an error like this, in this error, the wrong client secret has been used.
I hope this helps.
Hi! My script only returns this message and PRTG donesn’t recognize the output:
Backup failed, failed jobs: 0