Page 1 of 1

Monitoring of Disk Space by Size, rather than by percentage

Posted: Mon Nov 20, 2017 3:24 am
by bosco
Monitoring of Windows server Disk Space by Size, rather than by percentage

My requirement is to monitor Disk Space by Size and Change the Threshold from % to values in windows Server, from the support forum i followed instruction from the link and used a vb script for getting the disk usage in GB but on integrating with nagios is getting error: "UNKNOWN: No handler for that command "

Vb scipt for disk utilication from GB is take from the link https://exchange.nagios.org/directory/P ... ce/details

Please find the nsc.ini where i mention the script

[/settings/external scripts/wrapped scripts]
allow arguments=true
check_disk_gb-=cscript.exe //T:30 //NoLogo "scripts\\check_disk.vbs" /w:40 /c:20 /d:C /u:GB

i there any thing to be added for running the script

Re: Monitoring of Disk Space by Size, rather than by percent

Posted: Mon Nov 20, 2017 2:24 pm
by lmiltchev
Most probably you will need to move your command to the [/settings/external scripts/scripts] section. It is also possible that you forgot to enable external scripts module under [/modules]:

Code: Select all

CheckExternalScripts = 1
To be sure, we will need to see the entire nsclient.ini file. Please remove sensitive info, i.e. passwords, IP addresses.

Is there any reason that you are not using the check_nrpe with check_drivesize (instead of a custom script)?

Example:

Code: Select all

[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_drivesize -a drive=C: 'warning=used>100G' 'critical=used>150G' show-all 'perf-config=*(unit:G)' detail-syntax='{${drive_or_name} ${used} used / ${size} total}' top-syntax='${status}: ${problem_list}'
OK: {C: 77.395GB used / 107.47GB total}|'C: used'=77.39539G;100;150;0;107.46972 'C: used %'=72%;93;139;0;100
For more info: https://support.nagios.com/kb/article/d ... s-770.html

Re: Monitoring of Disk Space by Size, rather than by percent

Posted: Mon Nov 20, 2017 10:55 pm
by bosco
Thanks very much for your quick response and will try using your method.

Re: Monitoring of Disk Space by Size, rather than by percent

Posted: Tue Nov 21, 2017 2:13 am
by bosco
I tried with the command given in previous comment,but getting an error"CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

i am running this from my nagios core server.

Re: Monitoring of Disk Space by Size, rather than by percent

Posted: Tue Nov 21, 2017 10:18 am
by lmiltchev
Can you post the nsclient.ini and nsclient.log? Please remove sensitive info, i.e. passwords, IP addresses.

Re: Monitoring of Disk Space by Size, rather than by percent

Posted: Tue Nov 28, 2017 12:34 am
by bosco
Please find the attached nsclient and nsclient log file,tried both but getting error from client server working as expeccted but while running from nagios server throwing error.


Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).

CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

Re: Monitoring of Disk Space by Size, rather than by percent

Posted: Tue Nov 28, 2017 11:55 am
by lmiltchev
The following error:
Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).
can be usually resolved if you add:

Code: Select all

allow arguments = 1
allow nasty characters = 1
lines to BOTH, the [/settings/NRPE/server] AND [/settings/external scripts] section, and restart the nsclient++ service.

Can you show us the check that you are running on the nagios server against the Windows machine, along with the output of it? Are you using check_nrpe with the check_drivesize command or you are calling the "check_disk_gb-" script?

If you are using the second option, you will need to change this:

Code: Select all

[External Scripts]
check_disk_gb-=cscript.exe //T:30 //NoLogo check_disk.vbs /w:52 /c:30 /d:C /p /u:GB 
to this:

Code: Select all

[/settings/external scripts/scripts]
check_disk_gb = cscript.exe //T:30 //NoLogo scripts\check_disk.vbs /w:52 /c:30 /d:C /p /u:GB 
provided, the "check_disk.vbs" script is located in the NSClient++ scripts directory. I don't have this script, so I can't test it in-house but the arguments are "hardcoded", so you should be able to just run (on the nagios server):

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <ip address> -c check_disk_gb
Note: Don't forget that every time you make changes in the nsclient.ini file, you need to restart the nsclient++ service, so that the changes can take effect. Also, you are missing many options in the config file. If needed, you could add all of the "defaults" by running the following command from the Windows CMD as administrator:

Code: Select all

nscp settings --generate --add-defaults --load-all
See the top section of the nsclient.ini file.