You are here

check_cpu_stats works locally, but not via nrpe

3 posts / 0 new
Last post
Quang Le
quang_1's picture
check_cpu_stats works locally, but not via nrpe

Hello,

In opsview, via nrpe for a couple of hosts I can not get any cpu stats.  Eg this happens;

check_nrpe -H 'brxxx01' -c check_cpu_stats -C '' -k '' -r '' -y 'ADH-AES256-SHA:ADH-AES128-SHA' Output: NRPE: Unable to read output Errors: Return code: 3   Locally however on the box the check_cpu_stats seems to work when you run it from the cmd line; OK: utilization:4.8%,guest:0.0%,guest_nice:0.0%,iowait:0.0%,irq:0.0%,nice:0.0%,softirq:0.0%,steal:0.0%,system:0.4%,user:4.4%|'guest'=0.00%;;;0;100 'guest_nice'=0.00%;;;0;100 'iowait'=0.01%;;;0;100 'irq'=0.00%;;;0;100 'nice'=0.00%;;;0;100 'softirq'=0.00%;;;0;100 'steal'=0.00%;;;0;100 'system'=0.44%;;;0;100 'user'=4.38%;;;0;100 'utilization'=4.83%;;;0;100     from the nrpe.log you can see the following; Mar  2 09:24:29 bvinf11 nrpe[17380]: Host is asking for command 'check_cpu_stats' to be run...

Mar  2 09:24:29 bvinf11 nrpe[17380]: Running command: /usr/local/nagios/libexec/check_cpu_stats

Mar  2 09:24:29 bvinf11 nrpe[17380]: Command completed with return code 3 and output:

Mar  2 09:24:29 bvinf11 nrpe[17380]: Sending response - bytes left: 27

Mar  2 09:24:29 bvinf11 nrpe[17380]: Return Code: 3, Output: NRPE: Unable to read output   Other service checks using nrpe on the same host are working fine and returning results.    Any ideas about what could be wrong ?       
Duncan Ferguson
dferguson's picture
What user did you run the

What user did you run the local test as?  The nagios user?  Running the test as any other user may well create a local cache file with permissions the nagios user then cannot access the file with.

Also, you should always run the local test from / using the full path to the plugin as this is how NRPE runs them.  Running the test within the libexec directory can mask relative path errors.

  Duncs

Quang Le
quang_1's picture
You were right -- I was

You were right -- I was running it as root. 

Thanks for your help -- well played.