New command addition in Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ranjitw
Posts: 175
Joined: Tue Sep 01, 2015 1:52 am

New command addition in Nagios XI

Post by ranjitw »

Hi All,

Using service management I am adding the below two commands . After sending the arguments and performing the test activity I am getting errors.
When I give the same arguments directly from nagios server I am not facing any issue.

Can anyone please help in modifying the ARG2 for the below commands and share me an update ?


Service Management 1:

ARG1 : CheckCounter
ARG2 : -a ShowAll "Counter=\\LogicalDisk(D:)\\% Disk Time" MaxWarn=60 MaxCrit=70

Testing check from command line...
COMMAND: /usr/local/nagios/libexec/check_nrpe -p 5666 -H xxx.xx.xxx.xxx -t 30 -c CheckCounter -a ShowAll "Counter=\\\\LogicalDisk\(D:\)\\\\% Disk Time" MaxWarn=60 MaxCrit=70
OUTPUT: Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.


When I run the command from the Nagios server its running fine :

./check_nrpe -H xxx.xx.xxx.xxx -c CheckCounter -a ShowAll "Counter=\\LogicalDisk(D:)\\% Disk Time" MaxWarn=60 MaxCrit=70

OK: \LogicalDisk(D:)\% Disk Time = 0|'\LogicalDisk(D:)\% Disk Timenone'=0;60;70



Service Management2:

Testing check from command line...

ARG1 : CheckCounter
ARG2 : -a ShowAll "Counter=\\Process(CPUSTRES)\\% Processor Time" MaxWarn=20 MaxCrit=30

COMMAND: /usr/local/nagios/libexec/check_nrpe -p 5666 -H xxx.xxx.xx.xxx -t 30 -c CheckCounter -a ShowAll "Counter=\\\\Process\(CPUSTRES\)\\\\% Processor Time" MaxWarn=20 MaxCrit=30
OUTPUT: Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.

When I run the command from the Nagios server its running fine :

./check_nrpe -H xxx.xx.xxx.xxx -c CheckCounter -a ShowAll "Counter=\\Process(CPUSTRES)\\% Processor Time" MaxWarn=20 MaxCrit=30
CRITICAL: \Process(CPUSTRES)\% Processor Time = 41|'\Process(CPUSTRES)\% Processor Timenone'=41;20;30
Regards,
Ranjit W
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: New command addition in Nagios XI

Post by tgriep »

When using double quotes, the nagios process will add extra escaping on the arguments which is causing issues for you.
Try using single quotes and remove the escaping and see if it works for you.
Change the commands to be like below and see if that resolves it for you.

Code: Select all

-a ShowAll 'Counter=\LogicalDisk(D:)\% Disk Time' MaxWarn=60 MaxCrit=70
-a ShowAll 'Counter=\Process(CPUSTRES)\% Processor Time' MaxWarn=20 MaxCrit=30
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: New command addition in Nagios XI

Post by Box293 »

As well as what @tgriep said, due to some issues with how PHP escapes characters the "Test Check Command" does not work in these situations and should be ignored.

So for all further testing of this service you need to:

Make the changes to the service
Save the Service
Apply Confguration
Go back to the home screen and find the Service
When viewing the Service Status Details page click the Schedule a forced immediate check link

Just to re-iterate, for all further testing for this service DO NOT use the "Test Check Command" button, follow the steps above.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ranjitw
Posts: 175
Joined: Tue Sep 01, 2015 1:52 am

Re: New command addition in Nagios XI

Post by ranjitw »

Thanks a lot . The solution provided worked.
Please close the post
Regards,
Ranjit W
Locked