Problem reading perfmon counter from within Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Problem reading perfmon counter from within Nagios XI

Post by DennisPR »

I want to create a service showing me the number of Terminal Server connections by reading a perfmon counter with check_nt & nsclient 0.3.9
The test works fine from the command line as followed :

Code: Select all

/usr/local/nagios/libexec/check_nt -H 10.75.105.10 -s "N4gi0s" -p 12489 -v COUNTER -l "\\Terminal Services\\Total Sessions","TS  Connections are %.f"  -w 10 -c 20  
TS  Connections are 7 | 'TS  Connections are %.f'=7.000000%;10.000000;20.000000;

So I created a service as followed :

Code: Select all

define service {
	host_name			servername
	service_description		MS RDP : Current Connections
	use				service-template
	check_command			check_xi_service_nsclient!password!COUNTER -l "\Terminal Services\Total Sessions","TS  Connections are %.f"  -w 10 -c 20!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	contacts			nagiosadmin
	_xiwizard			windowsserver
	register			1
	}	
If I test the service with "test check command" button in CCM it works fine

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_nt -H 10.75.105.10 -s "N4gi0s" -p 12489 -v COUNTER -l "\\Terminal Services\\Total Sessions","TS  Connections are %.f"  -w 10 -c 20  
OUTPUT: TS  Connections are 7 | 'TS  Connections are %.f'=7.000000%;10.000000;20.000000;

So far so good... however. If I run the service through Nagios XI I get Performance Data: 'TS Connections are %.f'=0.000000%;10.000000;20.000000; as result in stead of 7 and I get the following error in the nsclient.log

Code: Select all

2013-05-27 16:39:10: error:modules\CheckSystem\CheckSystem.cpp:1084: ERROR: Counter not found: Terminal ServicesTotal Sessions: Unable to parse the counter path. Check the format and syntax of the  specified path.   (C0000BC0)
2013-05-27 16:39:10: error:modules\CheckSystem\CheckSystem.cpp:1086: ERROR: Counter not found: Terminal ServicesTotal Sessions: Unable to parse the counter path. Check the format and syntax of the  specified path.   (C0000BC0)
2013-05-27 16:39:10: error:modules\CheckSystem\CheckSystem.cpp:1115: ERROR: Terminal ServicesTotal Sessions: PdhAddCounter failed: Unable to parse the counter path. Check the format and syntax of the  specified path.   (C0000BC0) (Terminal ServicesTotal Sessions|Terminal ServicesTotal Sessions)
I think the problem is caused by the \ in the arguments. I've used single \ in $ARG2$ but Nagios XI/CCM uses double \ when testing the command and writes single \ in the service definition.

Extra info : I am using NSClient++-0.3.9-x64 from http://nsclient.org/nscp/downloads
Can someone tell me what's wrong please.
I have the same problem reading other perfmon counters as well.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Problem reading perfmon counter from within Nagios XI

Post by slansing »

You will need to add double "\\" to the command definition due to escaping rules, the reason is, the way paths are defined with performance counters, "using \'s" this actually is an escape character within Nagios, so you need to double them in your command definition since Nagios will remove one. This will cause the Test Check Command to not function as it will automatically double slashes, so it will end up trying to use "\\\\" however you will still be able to get valid check results through the main interface, Service Details page, etc. Let us know how things look after you make the change.
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Re: Problem reading perfmon counter from within Nagios XI

Post by DennisPR »

Thx for the info, works perfect !
Locked