NSClient - ERROR: Invalid return from command: check_pdh

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
RobJames
Posts: 3
Joined: Sun Oct 01, 2017 11:54 pm

NSClient - ERROR: Invalid return from command: check_pdh

Post by RobJames »

I have a server giving me an alert for Average Disk Write Queue Length on a Server 2008 R2 x64 saying "NSClient - ERROR: Invalid return from command: check_pdh"

After some checking, i ran the following on the server at cmd prompt:
typeperf "\Server Work Queues(0)\Queue Length"

Which returns:
"(PDH-CSV 4.0)","\\MYSERVERNAMEHERE\Server Work Queues(0)\Queue Length"
"10/02/2017 15:47:19.936","0.000000"
"10/02/2017 15:47:20.950","0.000000"
"10/02/2017 15:47:21.964","0.000000"

Implying locally the queue length is fine.

Then from the Nagios server, i ran:
./check_nt -H MYSERVERNAMEHERE -p 12489 -v COUNTER -l "\\Server Work Queues(0)\\Queue Length" -s MYPASSWORDHERE -w 4 -c 7

Which returns "0", implying the manual test is working from the Nagios server.

Any suggestions whyi'm getting an "NSClient - ERROR: Invalid return from command: check_pdh", when i can run the check manually and be successful?

Thanks
kyang

Re: NSClient - ERROR: Invalid return from command: check_pdh

Post by kyang »

Can I see how your check_nt command is defined in your

Code: Select all

/usr/local/nagios/etc/objects/commands.cfg
Along with how you defined it as a service with the check_command?
RobJames
Posts: 3
Joined: Sun Oct 01, 2017 11:54 pm

Re: NSClient - ERROR: Invalid return from command: check_pdh

Post by RobJames »

From the /usr/local/nagios/etc/objects/commands.cfg file:

# 'check_nt' command definition
define command{
command_name check_nt
command_line /usr/local/nagios/libexec/check_nt -H $HOSTADDRESS$ -p 12489 -s 'password' -v $ARG1$ $ARG2$
}

From the /usr/local/nagios/etc/objects/services.cfg file:

define service{
use generic-service
hostgroup_name ms-sql
service_description Average Disk Write Queue Length
check_command check_nt_disk_write_q!25!50
}
kyang

Re: NSClient - ERROR: Invalid return from command: check_pdh

Post by kyang »

This is how I have mine set, and I have the same command defined in the commands.cfg

Code: Select all

define service{
        use                     generic-service
        host_name               winserver
        service_description     Work Queues
        check_command           check_nt!COUNTER!-s "password" -l "\\Server Work Queues(0)\\Queue Length" -w 50 -c 100
        }

In Nagios Core, my output is 0.

Based on the variables.

Code: Select all

Valid variables are:
 CLIENTVERSION = Get the NSClient version
  If -l <version> is specified, will return warning if versions differ.
 CPULOAD =
  Average CPU load on last x minutes.
  Request a -l parameter with the following syntax:
  -l <minutes range>,<warning threshold>,<critical threshold>.
  <minute range> should be less than 24*60.
  Thresholds are percentage and up to 10 requests can be done in one shot.
  ie: -l 60,90,95,120,90,95
 UPTIME =
  Get the uptime of the machine.
  -l <unit>
  <unit> = seconds, minutes, hours, or days. (default: minutes)
  Thresholds will use the unit specified above.
 USEDDISKSPACE =
  Size and percentage of disk use.
  Request a -l parameter containing the drive letter only.
  Warning and critical thresholds can be specified with -w and -c.
 MEMUSE =
  Memory use.
  Warning and critical thresholds can be specified with -w and -c.
 SERVICESTATE =
  Check the state of one or several services.
  Request a -l parameters with the following syntax:
  -l <service1>,<service2>,<service3>,...
  You can specify -d SHOWALL in case you want to see working services
  in the returned string.
 PROCSTATE =
  Check if one or several process are running.
  Same syntax as SERVICESTATE.
 COUNTER =
  Check any performance counter of Windows NT/2000.
        Request a -l parameters with the following syntax:
        -l "\\<performance object>\\counter","<description>
        The <description> parameter is optional and is given to a printf
  output command which requires a float parameter.
  If <description> does not include "%%", it is used as a label.
  Some examples:
  "Paging file usage is %%.2f %%%%"
  "%%.f %%%% paging file used."
Let us know if this helps.
Locked