Nagios Plugin To Monitor RPO and More
Nagios has been a major player in open source monitoring for years. There are thousands of plugins created by the community to monitor almost everything.
We have created a Nagios plugin that uses Unitrends REST API and Powershell Toolkit to monitor RPO, alerts and backup status of your Unitrends backup appliance.
You can find the plugin (check_unitrends.ps1) in the Scripts folder of the Unitrends Powershell Toolkit.
The plugin supports 3 different tests:
- Alerts: Checks if your appliance has any critical or warning alert
- Backup Status: Checks if any of the last backup jobs has a status of “not successful”
- Backup RPO: Alerts if any asset in the catalog doesn’t have a backup in the last 24 hours
We are assuming that you have a basic knowledge of Nagios configuration. The script must run on a Windows machine running Nagios NSclient agent and be managed by Nagios.
Configure plugin in a Windows machine running Nagios NRPE/NSClient
-
- Download Unitrends Powershell Toolkit and extract to C:\Unitrends\unitrends-pstoolkit\
- Copy C:\Unitrends\unitrends-pstoolkit\Scripts\check_unitrends.ps1 to C:\Program Files\NSClient++\scripts
- Edit check_unitrends.ps1 and configure your path to unitrends pstoolkit modules folder and your unitrends IP and credentials
#----- DEFINE YOUR ENV SETTINGS" $PSTOOLKIT_MODULES = "C:\Unitrends\unitrends-pstoolkit\Modules" $SERVER = "192.168.11.20" $USER = "root" $PASSWD = "password" #----- END OF USER CONFIGURATION
-
- Check that you can run the script from powershell console
PS C:\Program Files\NSClient++\scripts> .\check_unitrends.ps1 -backup SUCCESS(4) NEVER(1)
-
- Edit C:\Program Files\NSClient++\nsclient.ini to add the 3 checks that will be available to nagios.
[/settings/external scripts/scripts] check_unitrends_alert = cmd /c echo scripts\check_unitrends.ps1 -alert; exit($lastexitcode) | powershell.exe -command - check_unitrends_backup = cmd /c echo scripts\check_unitrends.ps1 -backup; exit($lastexitcode) | powershell.exe -command - check_unitrends_catalog = cmd /c echo scripts\check_unitrends.ps1 -catalog; exit($lastexitcode) | powershell.exe -command -
- Restart NSClient window service
Configuring Nagios
-
- Test that you can run the remote tests from your nagios linux machine
[root@localhost ~]# /usr/lib64/nagios/plugins/check_nrpe -H 192.168.11.70 -c check_unitrends_alert NOTICE(4) CRITICAL(1) WARNING(2) [root@localhost ~]# /usr/lib64/nagios/plugins/check_nrpe -H 192.168.11.70 -c check_unitrends_backup SUCCESS(4) NEVER(1) [root@localhost ~]# /usr/lib64/nagios/plugins/check_nrpe -H 192.168.11.70 -c check_unitrends_catalog FAILED(4) OK(5)
-
- Define service tests for the windows machine (/etc/nagios/servers/win01.cfg)
define host { use windows-server host_name win01 alias Windows Server for Unitrends monitor address 192.168.11.70 } define service { use generic-service host_name win01 service_description PING check_command check_ping!100.0,20%!500.0,60% } define service { use generic-service host_name win01 service_description Unitrends Alerts check_command check_nrpe!check_unitrends_alert } define service { use generic-service host_name win01 service_description Unitrends Backup Status check_command check_nrpe!check_unitrends_backup } define service { use generic-service host_name win01 service_description Unitrends Backup RPO check_command check_nrpe!check_unitrends_catalog }
- Reload or Restart nagios
Now you should be able to monitor the status of your Unitrends appliance from Nagios console.
Please send us feedback! Are there other monitoring functions you would like to see for Unitrends appliances?