Page 1 of 1

CPU, Memory staus = NRPE Unable to read output

Posted: Sat Feb 28, 2015 1:21 pm
by tecnalb
I sent a new server this weekend. Its RHEL6x64, latest patches.

I installed the linux-nape from the link on my NXI server, which also is the latest.

On CPU, memory, open files its all NRPE unreadable... other items are fine

[root@nagios libexec]# ./check_nrpe -H x.x.x.x -c check_cpu_stats -a '-w 85 -c 95'
NRPE: Unable to read output

I ran the local check_cpu_stats.sh and got this:

[root@host1 libexec]# ./check_cpu_stats.sh
./check_cpu_stats.sh: line 139: [: 0.00: integer expression expected
./check_cpu_stats.sh: line 142: [: 0.00: integer expression expected
./check_cpu_stats.sh: line 152: [: 0.05: integer expression expected
./check_cpu_stats.sh: line 156: [: 0.05: integer expression expected
./check_cpu_stats.sh: line 160: [: 0.00: integer expression expected
./check_cpu_stats.sh: line 164: [: 99.90: integer expression expected
CPU STATISTICS OK: user=0.05% system=0.05% iowait=0.00% idle=99.90% | user=0.05% system=0.05% iowait=0.00%;30;100 idle=99.90%

So I am comparing this device to a working device I setup a week ago, which is the same OS, and the modules seem to be the same.

My NXI GUI the setting commands look the same. One works one does not. I did update my wizard to the latest version as well.

So at this point I have manually/locally run checks and I get feedback from both, locally


Also, just an FYI, the nrpe install script is overwriting the iptable files. I had two entries in mine.... the time i installed the agent. Beautiful!!

# Generated by iptables-save v1.4.7 on Sat Feb 28 12:48:05 2015
*filter
:INPUT ACCEPT [5:260]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5667 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5666 -j ACCEPT
COMMIT
# Completed on Sat Feb 28 12:48:05 2015

Re: CPU, Memory staus = NRPE Unable to read output

Posted: Sun Mar 01, 2015 6:47 pm
by Box293
Basically the script is getting bash to compare non integer numbers (numbers with decimal places) and bash complains about this.

To correct the problem, I've adjusted the script so the numbers it's comparing are integers ... I'm basically removing anything after the .

This update script should work for you:
check_cpu_stats.zip

Re: CPU, Memory staus = NRPE Unable to read output

Posted: Mon Mar 02, 2015 6:53 am
by tecnalb
Thanks for the update. I'll give it a shot. However, I'm not sure it's my underlying issue. Seems my working server is displaying the same results when run on the local host. There is something else causing my results to not be passed back to NXI. I'm just not sure what at this point.

Re: CPU, Memory staus = NRPE Unable to read output

Posted: Mon Mar 02, 2015 12:24 pm
by jolson
Regarding "NRPE: Unable to read output", this could be caused by a variety of things. It is common that the issue could be related to permissions or SELinux Policy.

For SELinux, you could try:

Code: Select all

getenforce
If getenforce is Enforcing, you could temporarily disable it with:

Code: Select all

setenforce 0
After disabling SELinux, retry the procedure.

If SELinux isn't the culprit, be sure that the permissions for the files on your remote machine are set properly:

Code: Select all

ls -lZ /usr/local/nagios/libexec
The permissions should match the rest of the files in libexec (755 perms).

This could also be caused by sudo issues. Please report the following:

Code: Select all

cat /etc/sudoers | grep tty
Also, try running the check through NRPE using the remote host:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H localhost -c myplugin
Please report back and let us know the results of the above. Thanks very much!

Re: CPU, Memory staus = NRPE Unable to read output

Posted: Mon Mar 02, 2015 1:17 pm
by tecnalb
Ahhh.... SELINUX was disabled, but was not when I installed the agent. So those files permissions were set 750.

Thank you sir!

Re: CPU, Memory staus = NRPE Unable to read output

Posted: Mon Mar 02, 2015 2:23 pm
by jolson
Not a problem. I'll go ahead and lock this case out. Thanks!