Ein weiteres Plugin im Kreise der ESX-Checks: mit dem Script check_vranger_jobstatus.ps1 können Status und Laufzeit von VRanger Backup-Jobs überwacht werden.
Das per NRPE auf dem VRanger-Host aufgerufene Plugin bedient sich dabei der vRanger API, die es über das PowerShell-Snapin vRanger.API.PowerShell anspricht..
One more plugin for ESX environments: with check_vranger_jobstatus.ps1 you can monitor status and runtime of VRanger backup jobs.
The plugin is called via NRPE and talks with VRanger’s API.
Download check_vranger_jobstatus.tar.gz
The interval of a daily backup job is “24”; with the parameters -interval_warning and -interval_critical you can define, how the interval time is allowed to be prolonged (e.g. with on-demand-jobs).
If the last job was “Completed”, but not “Successful”, then the plugin exits with a proper message:
CRITICAL: Last backup job "esxcluster44" completed with errors!
If a successful completed job was found, which also ran within the scheduled interval, then the plugin checks the execution time and compares it with -duration_warning und -duration_critical.
Some examples:
./check_nrpe -H vranger02 -c check_vranger_jobstatus -t 60 -a '-jobname cluster11 -duration_warning 5 -duration_critical 6.5 -interval_warning 25 -interval_critical 28' OK: Backup job "cluster11" completed in 1.8 hours (warn at 5h, crit at 6.5h) at 12/22/2013 22:45:55.|backup_time=1.8h;5;6.5;;
Last backup too old (interval exceeded):
./check_nrpe -H vranger02 -c check_vranger_jobstatus -t 120 -a '-jobname cluster12 -duration_warning 5 -duration_critical 6.5 -interval_warning 25 -interval_critical 28' CRITICAL: Last backup job "cluster12" was started 32 hours ago. (warn at 25h, crit at 28h).
Runtime exceeded:
./check_nrpe -H vranger02 -c check_vranger_jobstatus -t 60 -a '-jobname cluster11 -duration_warning 1 -duration_critical 3 -interval_warning 25 -interval_critical 28' WARNING: Backup job "cluster11" completed in 1.8 hours (warn at 1h, crit at 3h) at 12/22/2013 22:45:55.|backup_time=1.8h;1;3;;
First, check if the Snapin is already installed:
Get-PSSnapin
If it does not appear in the list of installed PS-Snap-Ins, it has to be installed first:
C:\Windows\Microsoft.NET\Framework\v2.0.50727>installutil.exe C:\Program Files (x86)\Quest Software\vRanger\PowerShell\vRanger.API.PowerShell.dll
Then execute
Set-ExecutionPolicy RemoteSigned
to allow also the execution of custom scripts.
check_vranger_jobstatus.ps1 has to be installed in the scripts directory of NSClient++ (e.g. *C:\Program Files\NSClient++\scripts*). This is the NRPE command handler, which allows Nagios to execute the Powershell script:
check_vranger_jobstatus=powershell -NoLogo -InputFormat none -NoProfile -NonInteractive -command "& {scripts\check_vranger_jobstatus.ps1 $ARG1$; exit $lastexitcode}"
At last, restart NSClient++.