NRPE: Unable to read output

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
w-bao
Posts: 33
Joined: Mon Apr 04, 2016 11:57 am

NRPE: Unable to read output

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE: Unable to read output

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
w-bao
Posts: 33
Joined: Mon Apr 04, 2016 11:57 am

Re: NRPE: Unable to read output

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE: Unable to read output

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
w-bao
Posts: 33
Joined: Mon Apr 04, 2016 11:57 am

Re: NRPE: Unable to read output

Post 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?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE: Unable to read output

Post 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'.
Former Nagios Employee
w-bao
Posts: 33
Joined: Mon Apr 04, 2016 11:57 am

Re: NRPE: Unable to read output

Post by w-bao »

OK. thank you!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: NRPE: Unable to read output

Post by mcapra »

Is it alright if we lock this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
Locked