Page 1 of 1

Problems with NSClient and check_nt

Posted: Mon Apr 23, 2012 10:29 am
by GaWd
We are having an issue getting Nagios and the NSClient to issue warnings using check_nt. We are using the following service, command, and nsclient++ check:

define service {
host_name SERVERNAME
check_command Windows-nrpe_check_disk_c
max_check_attempts 5
normal_check_interval 60
retry_interval 5
active_checks_enabled 1
passive_checks_enabled 1
check_period 24x7
parallelize_check 1
obsess_over_service 1
check_freshness 1
freshness_threshold 0
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 0
notification_period 24x7
notifications_enabled 1
failure_prediction_enabled 1
service_description Drive C Space
display_name
notification_options u,c,r,f
stalking_options o,w,u,c
contact_groups Email - Group IT Support,Pagers
}

define command {
command_name Windows-nrpe_check_disk_c
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v USEDDISKSPACE -l C [-w 80%] [-c 95%]
}

;alias_disk=CheckDriveSize MinWarn=90% MinCrit=95% CheckAll FilterType=FIXED
alias_disk=CheckDriveSize MinWarnUsed=80% MaxCritUsed=5% Drive=c:\
alias_disk=CheckDriveSize MinWarnUsed=80% MaxCritUsed=5% Drive=e:\

The commented out nsclient++ command is the command that was in place when the disk filled up. I then changed it to the commands below it to see if I could trigger an alert, and it won't. If I run the check_nt command from the command line, I get this output (which shows that it should be alerting, but there is no CRITICAL response):

[root@nagios ~]# /usr/lib/nagios/plugins/check_nt -H SERVERNAME -v USEDDISKSPACE -l c -w [80%] -c [95%]
c:\ - total: 39.90 Gb - used: 39.29 Gb (98%) - free 0.61 Gb (2%) | 'c:\ Used Space'=39.29Gb;0.00;0.00;0.00;39.90

What am I missing?

Re: Problems with NSClient and check_nt

Posted: Mon Apr 23, 2012 7:15 pm
by jsmurphy
Based on my understanding if you are using check_nt you only get access to the scripts built into the NSClient++ executable so changing anything in the alias section will have no effect whatsoever. You need to use check_nrpe to make use of the alias commands.

I believe your problem however is that you have put square brackets around the warning and critical... they are unnecessary so your command should look like:

define command {
command_name Windows-nrpe_check_disk_c
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v USEDDISKSPACE -l C -w 80% -c 95%
}

The brackets in the help output specify that the -w and -c are optional switches, if you don't provide them it will use the defaults.

Re: Problems with NSClient and check_nt

Posted: Tue Apr 24, 2012 11:27 am
by GaWd
Thanks for the reply.

I ended up abandoning check_nt for check_nrpe. I'm not sure when this stopped working, but it's left us unprotected for some time now. This probably existed long before I took my position, too.

Here's the check I ended up deploying:

define command {
command_name Windows-nrpe_check_disk_c1
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckDriveSize -a Drive=c ShowAll MinWarnFree=20% MinCritFree=10%
}

Re: Problems with NSClient and check_nt

Posted: Tue Apr 24, 2012 6:02 pm
by jsmurphy
Awesome glad you got it working, NRPE tends to be preferred (with good reason) these days anyway