Page 1 of 1

nrpe nsclient++ check counter - No counters specified

Posted: Thu Jun 16, 2016 4:49 am
by zjllee
Hi I have been trying to use the check counter function via nrpe+nsclient but I keep getting a "No counters specified: add counter=<name of counter>" unknown status in Nagios. Anyone can comment on what I am doing wrong. Here're the different ways that I have tried defining the services with no luck:

check_command check_nrpe!CheckCounter!'Counter:Idle Timer=\Processor Information(_Total)\% Idle Time' Showall MaxWarn=80 MaxCritcrit=90
check_command check_nrpe!CheckCounter!'Counter:% Processor Used Core 0=\Processor(0)\% Processor Time' ShowAll MaxWarn=80 MaxCrit=90
check_command check_nrpe!CheckCounter!'Counter=\\Print Queue(Microsoft XPS Document Writer)\\Jobs' MaxWarn=5 MaxCrit=15 ShowAll

CheckSystem is enabled on the nsclient++ agent. Thank you

Re: nrpe nsclient++ check counter - No counters specified

Posted: Thu Jun 16, 2016 9:43 am
by lmiltchev
Can you show us the actual command run from the command line along with the output of it?

Example:

Code: Select all

[root@localhost libexec]# ./check_nrpe -H x.x.x.x -c CheckCounter -a 'Counter:Idle Timer=\Processor Information(_Total)\% Idle Time' Showall MaxWarn=80 MaxCritcrit=90
WARNING: Idle Timer = 94|'Idle Timernone'=94;80;0
Also, show us the "check_nrpe" command definition.

Re: nrpe nsclient++ check counter - No counters specified

Posted: Thu Jun 16, 2016 10:10 am
by rkennedy
Also - to add to what Ludmil mentioned, I did some testing on my end. I was seeing mixed results with single quotes, but it worked with double quotes. Could you try using double quotes?

Code: Select all

[root@localhost libexec]# ./check_nrpe -H 192.168.5.47 -c CheckCounter -a "Counter=\\Server\\Errors Logon"
OK: \Server\Errors Logon = 0|'\Server\Errors Logonnone'=0;0;0
[root@localhost libexec]# ./check_nrpe -H 192.168.5.47 -c CheckCounter -a 'Counter=\\Server\\Errors Logon'
Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.

Re: nrpe nsclient++ check counter - No counters specified

Posted: Thu Jun 16, 2016 7:11 pm
by Box293
This article explains how the counters need to be referenced (double slashes):

https://support.nagios.com/kb/article.php?id=126

This one explains how to add a service:

https://support.nagios.com/kb/article.php?id=127

Re: nrpe nsclient++ check counter - No counters specified

Posted: Fri Jun 17, 2016 1:36 am
by zjllee
Thanks all!

Turns out I did not initiate the nsclient config file properly. By running nscp settings --generate --add-defaults --load-all in the nsclient install folder, I am able to set allow arguments and allow nasty characters to 1. Did the trick.

Code: Select all

root@nagioscore:/usr/lib/nagios/plugins# ./check_nrpe -H winserver -c CheckCounter -a 'Counter:Idle Timer=\Processor Information(_Total)\% Idle Time' Showall MaxWarn=80 MaxCritcrit=90
WARNING: Idle Timer = 95|'Idle Timernone'=95;80;0

Code: Select all

root@nagioscore:/usr/lib/nagios/plugins# ./check_nrpe -H winserver -c CheckCounter -a "Counter=\\Server\\Errors Logon"
OK: \Server\Errors Logon = 0|'\Server\Errors Logonnone'=0;0;0
With regards to slashes and quotes, single slashes work with single quotes, and double slashes work with double quotes.

Re: nrpe nsclient++ check counter - No counters specified

Posted: Fri Jun 17, 2016 10:52 am
by rkennedy
Ah, nice find -- I had ruled out the single quotes.

Are we good to mark this as resolved?

Re: nrpe nsclient++ check counter - No counters specified

Posted: Mon Jun 20, 2016 2:08 am
by zjllee
lmiltchev wrote:Can you show us the actual command run from the command line along with the output of it?

Example:

Code: Select all

[root@localhost libexec]# ./check_nrpe -H x.x.x.x -c CheckCounter -a 'Counter:Idle Timer=\Processor Information(_Total)\% Idle Time' Showall MaxWarn=80 MaxCritcrit=90
WARNING: Idle Timer = 94|'Idle Timernone'=94;80;0
Also, show us the "check_nrpe" command definition.
Just add on, my command was defined wrongly - this was the main cause of the error as checkcounter requires the -a attribute to be defined.

Wrong

Code: Select all

define command{
        command_name    check_nrpe
        command_line    /usr/lib/nagios/plugins/check_nrpe -H '$HOSTADDRESS$' -c '$ARG1$'
}
Correct

Code: Select all

define command {
        command_name    check_nrpe
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
This issue can be considered resolved. Thanks to all for the advice.