check_nrpe with WMI scripting

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mcnabbm
Posts: 5
Joined: Wed Sep 25, 2013 8:32 am

check_nrpe with WMI scripting

Post by mcnabbm »

COMMAND: /usr/local/nagios/libexec/check_nrpe -H BAMDEV1D1 -t 30 -c CheckWMIValue -a "Query=Select DriveLetter, FreeSpace from win32_Volume where DriveType=3" MinCrit=5000 Check:Disk=FreeSpace AliasCol=DriveLetter

OUTPUT: OK: Everything seems fine.|'C: Disk'=3375972352;0;5000 'D: Disk'=8470765568;0;5000 'P: Disk'=1317314560;0;5000

I finally got the script to work and asked our windows engineer if the information being reported was acceptable and he said he would prefer to set a percentage value then the freespace numeric value.

I have spent several hours trying to find the commands to use to get the percentage. I tried to use "MinCrit=5%" as I saw in a web tutorial but no luck. I need some help.
The other thing is if I want to split it out and write a specific script for each logical Drive, how would I accomplish that?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nrpe with WMI scripting

Post by lmiltchev »

Unfortunately, getting a percentage in the output is not possible with WMI, unless you create a custom script, and do some math with the data. You can probably use check_nt, for example:

Code: Select all

/usr/local/nagios/libexec/check_nt -H <ip> -s "password" -p 12489 -v USEDDISKSPACE -l C -w 80 -c 95
C:\ - total: 452.96 Gb - used: 230.62 Gb (51%) - free 222.34 Gb (49%) | 'C:\ Used Space'=230.62Gb;362.37;430.31;0.00;452.96
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked