Syntax Needed for NRPE CheckCounter with Service Definition

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ethantester123
Posts: 4
Joined: Thu Apr 07, 2011 8:19 am

Syntax Needed for NRPE CheckCounter with Service Definition

Post 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
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Syntax Needed for NRPE CheckCounter with Service Definit

Post by tonyyarusso »

Try using single quotes in your service definition, eg.
check_command check_nrpe_win_counter!'\Paging File(_Total)\% Usage'!80%!90%
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
ethantester123
Posts: 4
Joined: Thu Apr 07, 2011 8:19 am

Re: Syntax Needed for NRPE CheckCounter with Service Definit

Post 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!!
rdedon
Posts: 578
Joined: Sat Nov 20, 2010 4:51 pm

Re: Syntax Needed for NRPE CheckCounter with Service Definit

Post by rdedon »

Ahhh good to know and thank you for the update, very helpful ;)
Rene deDon
Technical Team
___
Nagios Enterprises, LLC
Web: http://www.nagios.com
Locked