Page 1 of 2
NRPE check_cpu_stats unable to read, but other NRPE are fine
Posted: Fri May 06, 2016 3:11 pm
by encee
Hello,
I recently installed nrpe on a few more servers and as far as I can tell theres no difference in the install process.
the nrpe check cpu fails with NRPE: Unable to read output but I can execute the command on the server as the nagios user with no issues.
Check memory/load other nrpe checks all pass successfully as well.
Does anyone have an idea as to why it wont run?
Re: NRPE check_cpu_stats unable to read, but other NRPE are
Posted: Fri May 06, 2016 3:16 pm
by encee
To elaborate, I can run the command on the destination server for the cpu check fine. The check fails from the xi server.
Re: NRPE check_cpu_stats unable to read, but other NRPE are
Posted: Sun May 08, 2016 8:01 pm
by Box293
Please read through this guide as it should address your issue:
https://support.nagios.com/kb/article.php?id=140
If this doesn't fix your problem, please let us know what you tried (including commands typed) and what the output/result is.
Re: NRPE check_cpu_stats unable to read, but other NRPE are
Posted: Mon May 09, 2016 11:42 am
by encee
Followed step - VII. NRPE: Unable To Read Output
is nrpe installed? yes
check path -
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
/usr/local/nagios/libexec $ ls -d $PWD/*
/usr/local/nagios/libexec/check_cpu_stats.sh
paths match. and sh file executes fine with proper return.
/bin/bash /usr/local/nagios/libexec/check_cpu_stats.sh -w 85 -c 95
CPU STATISTICS OK: user=0.00% system=0.50% iowait=0.00% idle=99.50% | user=0.0% system=0.0% iowait=0.0%;85;95 idle=99.50%
nrpe is running - tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 12014/xinetd
Plugin does not require sudo privileges.
Re: NRPE check_cpu_stats unable to read, but other NRPE are
Posted: Mon May 09, 2016 1:12 pm
by rkennedy
What are the permissions of /usr/local/nagios/libexec/check_cpu_stats.sh? ls -l /usr/local/nagios/libexec/check_cpu_stats.sh
Re: NRPE check_cpu_stats unable to read, but other NRPE are
Posted: Mon May 09, 2016 3:02 pm
by encee
-rwxr-xr-x 1 root root 5580 May 6 19:50 /usr/local/nagios/libexec/check_cpu_stats.sh
This is the same as my other servers.
Re: NRPE check_cpu_stats unable to read, but other NRPE are
Posted: Mon May 09, 2016 4:20 pm
by tgriep
When you run the check from the command line on the remote server, are you using /bin/bash to run the command?
If so, add that to the script or edit the command in the nrpe.cfg file and add that like below.
Code: Select all
command[check_cpu_stats]=/bin/bash /usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
What is the OS and version of the remote system you are trying to monitor?
Re: NRPE check_cpu_stats unable to read, but other NRPE are
Posted: Mon May 09, 2016 4:28 pm
by encee
That fixed the issue.
After investigating further it looks like we are creating the nagios user ahead of time to ensure its uid/gid don't overlap on other servers, what should the shell be set to for this? Its currently using /bin/bash.
from /etc/passwd
old servers without precreating user - nagios

1012

:/home/nagios:
new servers with precreating user - nagios

1013

:/home/nagios:/bin/bash
Is there any documentation on the proper way to specify a uid/gid for nagios upon installing nrpe?
Re: NRPE check_cpu_stats unable to read, but other NRPE are
Posted: Mon May 09, 2016 5:00 pm
by tgriep
The default shell is /bin/bash for the nagios user account.
Is there a reason you want to set the same uid/gid for the nagios account?
Here are the instructions for Installing NRPE. Take a look at them for any details.
Code: Select all
https://assets.nagios.com/downloads/nagiosxi/docs/How-To-Configure-NRPE-and-Install-From-Source-with-Nagios-XI.pdf
Re: NRPE check_cpu_stats unable to read, but other NRPE are
Posted: Tue May 10, 2016 5:06 pm
by encee
As of this moment it is for consistency with our automation. At this moment I am not seeing anything in the manual source compile that would affect this, also this issue arose even after removing the user and the local files and reinstalling. Same problem with the output.