NRPE check_cpu_stats unable to read, but other NRPE are fine

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

NRPE check_cpu_stats unable to read, but other NRPE are fine

Post 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?
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: NRPE check_cpu_stats unable to read, but other NRPE are

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

Re: NRPE check_cpu_stats unable to read, but other NRPE are

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: NRPE check_cpu_stats unable to read, but other NRPE are

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

Re: NRPE check_cpu_stats unable to read, but other NRPE are

Post 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
Former Nagios Employee
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: NRPE check_cpu_stats unable to read, but other NRPE are

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

Re: NRPE check_cpu_stats unable to read, but other NRPE are

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: NRPE check_cpu_stats unable to read, but other NRPE are

Post 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:x:1012:1012::/home/nagios:
new servers with precreating user - nagios:x:1013:1013::/home/nagios:/bin/bash

Is there any documentation on the proper way to specify a uid/gid for nagios upon installing nrpe?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE check_cpu_stats unable to read, but other NRPE are

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: NRPE check_cpu_stats unable to read, but other NRPE are

Post 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.
Locked