Page 1 of 1

Syntax Needed for NRPE CheckCounter with Service Definition

Posted: Wed Apr 13, 2011 4:09 am
by ethantester123
Hello All,

I have been trying to use the NRPE CheckCounter in my Nagios 3.2 setup . What i am trying to do is create a command definition that would accept an Counter parameter as follows:

define command{
command_name check_nrpe_win_counter
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter=$ARG1$" ShowAll MaxWarn=$ARG2$ MaxCrit=$ARG3$
}

then define a service as:
define service{
use generic-service
host MyHost
check_command check_nrpe_win_counter!"\Paging File(_Total)\% Usage"!80%!90%
}

After using this all i get is "CRIT: Counter not found" error.
I am able to use the command from command line.

Also if a create the command definition directly without using the counter parameter (i.e instead of "Counter=$ARG1$" i directly define "Counter=\Paging File(_Total)\% Usage") as argument then it works fine, but then i would have to create n no of command definitions for n no of counter values which i dont want to do.

Please can some one give me the exact syntax.

Thanks in Advance
Ethan

Re: Syntax Needed for NRPE CheckCounter with Service Definit

Posted: Wed Apr 13, 2011 9:41 am
by tonyyarusso
Try using single quotes in your service definition, eg.
check_command check_nrpe_win_counter!'\Paging File(_Total)\% Usage'!80%!90%

Re: Syntax Needed for NRPE CheckCounter with Service Definit

Posted: Fri Apr 15, 2011 12:53 am
by ethantester123
I have modified the above command as following, and now they are working fine :)

define command{
command_name check_nrpe_win_counter
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a $ARG1$ ShowAll MaxWarn=$ARG2$ MaxCrit=$ARG3$
}

then define a service as:
define service{
use generic-service
host MyHost
check_command check_nrpe_win_counter!"\\Paging File(_Total)\\% Usage"!80%!90%
}

Note: We need to add double back slashes instead of single, and use double quotes!!

Re: Syntax Needed for NRPE CheckCounter with Service Definit

Posted: Fri Apr 15, 2011 10:50 am
by rdedon
Ahhh good to know and thank you for the update, very helpful ;)