Page 1 of 1

NRPE: Unable to read output

Posted: Fri Jun 24, 2016 11:07 am
by w-bao
I just configured Nagios monitoring on two RHEL 6 servers. Everything works fine except the CPU and Mem monitors on both. I got 'NRPE: Unable to read output' error. Same check_nrpe works for other monitors like disks, etc.

This is the command Nagios uses:
/usr/local/nagios/libexec/check_nrpe -H 172.20.60.143 -t 30 -c check_cpu_stats -a '-w 90 -c 95'

Result:
NRPE: Unable to read output

Re: NRPE: Unable to read output

Posted: Fri Jun 24, 2016 11:30 am
by tgriep
This error implies that NRPE did not return any character output. Common causes are incorrect plugin paths in the nrpe.cfg file or that
the remote host does not have NRPE installed. There are also cases where the wrong interpreter is invoked when running the remote
plugin. Rarely, it is caused by trying to run a plugin that requires root privileges.
Take a look the NRPE troubleshooting guide for more details.
https://assets.nagios.com/downloads/nag ... utions.pdf

If the above doesn't help, can you post your nrep.cfg file from the remote host so we can view it?

Re: NRPE: Unable to read output

Posted: Fri Jun 24, 2016 3:23 pm
by w-bao
The guide is for check_nrpe not working at all. But in my case, for the same client, Other check_nrpe work but not for CPU/Mem.

COMMAND: /usr/local/nagios/libexec/check_nrpe -H vm-nesvscan1-tts -t 30 -c check_load -a '-w 15,10,5 -c 30,20,10'
OK - load average: 0.79, 0.69, 0.54|load1=0.790;15.000;30.000;0; load5=0.690;10.000;20.000;0; load15=0.540;5.000;10.000;0;
/usr/local/nagios/libexec/check_nrpe -H vm-nesvscan1-tts -t 30 -c check_disk -a '-w 20% -c 10% -p /'
DISK OK - free space: / 3107 MB (84% inode=94%);| /=591MB;3122;3512;0;3903
/usr/local/nagios/libexec/check_nrpe -H vm-nesvscan1-tts -t 30 -c check_cpu_stats -a '-w 90 -c 95'
NRPE: Unable to read output
/usr/local/nagios/libexec/check_nrpe -H vm-nesvscan1-tts -t 30 -c check_mem -a '-w 90 -c 95'
NRPE: Unable to read output

Re: NRPE: Unable to read output

Posted: Mon Jun 27, 2016 2:36 am
by Box293
w-bao wrote:/usr/local/nagios/libexec/check_nrpe -H vm-nesvscan1-tts -t 30 -c check_mem -a '-w 90 -c 95'
NRPE: Unable to read output
On the remote host as root run:

Code: Select all

chown nagios:nagios /usr/local/nagios/libexec/custom_check_mem
Also, WARNING threshold must be greater than CRITICAL. Try:

Code: Select all

check_nrpe -H rhel02 -c check_mem -a '-w 10 -c 5'

OK - 892 / 996 MB (89%) Free Memory, Used: 181 MB, Shared: 0 MB, Buffers: 8 MB, Cached: 77 MB | total=996MB free=892MB used=181MB shared=0MB buffers=8MB cached=77MB
w-bao wrote:/usr/local/nagios/libexec/check_nrpe -H vm-nesvscan1-tts -t 30 -c check_cpu_stats -a '-w 90 -c 95'
NRPE: Unable to read output
On the remote host as root run:

Code: Select all

chown nagios:nagios /usr/local/nagios/libexec/check_cpu_stats.sh

Re: NRPE: Unable to read output

Posted: Tue Jun 28, 2016 2:52 pm
by w-bao
That fixed the memory check issue. I did the same thing to check_cpu_stats.sh and it fixed the CPU issue. Interesting.

Just curious, how come the default setting works on other RHEL 6 clients? And how come other checks like check_disk, check_load work with root ownership on the same client?

Re: NRPE: Unable to read output

Posted: Tue Jun 28, 2016 4:07 pm
by rkennedy
It really all depends on how each plugin is gaining it's information that it sets as variables. Some will use commands that can run without any issues not under root, while some have one single function that is dependent on being able to have rights in the sudoers. With your case though, it sounds like comparable files might have had a read flag on the 'other' section, so the ownership wasn't needed, while this one may have been a read flag for 'other'.

Re: NRPE: Unable to read output

Posted: Fri Jul 01, 2016 9:40 am
by w-bao
OK. thank you!

Re: NRPE: Unable to read output

Posted: Tue Jul 05, 2016 9:00 am
by mcapra
Is it alright if we lock this thread and mark the issue as resolved?