Page 1 of 2
NRPE check_init_service returning: Unable to read output
Posted: Tue Apr 17, 2012 1:33 pm
by GreatWolfResorts
We're looking to monitor a few of our Ubuntu servers Nagios. I walked through the initially installation of the client on a clean Ubuntu test server by following this documentation:
http://assets.nagios.com/downloads/nagi ... _Agent.pdf
Brief description of procedures is as follows:
Code: Select all
Apt-get install python-software-properties
Add-apt-repository ppa:nagiosinc/ppa
Apt-get update
Apt-get install nagios-agent
Apt-get install sysstat
The only checks failing at this point are the service checks, referencing check_init_service. These are returning "NRPE: Unable to read output."
Code: Select all
[root@noc libexec]# ./check_nrpe -H 10.*.*.* -t 30 -c check_init_service -a 'cron'
NRPE: Unable to read output
The services in question are:
I did however notice that running the following check returned success for the nagios-nrpe-server service:
Code: Select all
[root@noc libexec]# ./check_nrpe -H 10.*.*.* -t 30 -c check_init_service -a 'nagios-nrpe-server'
* nagios-nrpe is running
My instinct is telling me this is permission related, but I'm just not savvy enough in Linux to know where to go from here. Any help would be greatly appreciated!
Re: NRPE check_init_service returning: Unable to read output
Posted: Tue Apr 17, 2012 2:22 pm
by scottwilkerson
I believe you need to run visudo and provide nagios user access to files and applications.
Code: Select all
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_init_service
Re: NRPE check_init_service returning: Unable to read output
Posted: Tue Apr 17, 2012 3:10 pm
by GreatWolfResorts
Looks like no dice on that one. I added the line you specified to visudo and went as far as reboot the remote client. What I'm curious about is the path you gave me /usr/local/nagios/libexec/check_init_service doesn't exist on the remote machine. It appears these are found at /usr/lib/nagios/plugins. I've tried this path as well in visudo without luck.
Re: NRPE check_init_service returning: Unable to read output
Posted: Tue Apr 17, 2012 3:33 pm
by scottwilkerson
you used the full path to this file correct?
Code: Select all
/usr/lib/nagios/plugins/check_init_service
Also, you will likely need to modify the command command[check_init_service] in your nrpe.cfg to start with sudo if it doesn't.
Re: NRPE check_init_service returning: Unable to read output
Posted: Wed Apr 18, 2012 8:28 am
by GreatWolfResorts
Sorry, yes - the full path used is:
Code: Select all
/usr/lib/nagios/plugins/check_init_service
I also added "sudo" in front of the command command[check_init_service] in nrpe.cfg but still receiving failure after service restarts.
When I run the check locally it appears to return value just fine. It's only when attempting to check from our Nagios server that it fails.
Remote Server
Code: Select all
root@TL-UBUNTU:/usr/lib/nagios/plugins# ./check_init_service cron
cron start/running, process 679
Nagios Server
Code: Select all
[root@noc libexec]# ./check_nrpe -H 10.*.*.* -c check_init_service -a cron
NRPE: Unable to read output
Re: NRPE check_init_service returning: Unable to read output
Posted: Wed Apr 18, 2012 9:27 am
by mguthrie
Can you run:
on the client machine and attempt the check again. Do you see any errors showing up in the syslog that point to the issue?
Re: NRPE check_init_service returning: Unable to read output
Posted: Wed Apr 18, 2012 11:02 am
by GreatWolfResorts
I'm tailing /var/log/syslog on the remote machine. Turns out the later versions of Ubuntu don't use a messages log anymore. It doesn't appear I have anything to work with on the syslog side. The most I have generated is a cron job running every 10 minutes, and an earlier record of me starting up the nrpe service:
Code: Select all
Apr 18 08:02:39 TL-UBUNTU nrpe[898]: Starting up daemon
Apr 18 08:02:39 TL-UBUNTU nrpe[898]: Warning: Daemon is configured to accept command arguments from clients!
Apr 18 08:02:39 TL-UBUNTU nrpe[898]: Listening for connections on port 5666
Apr 18 08:02:39 TL-UBUNTU nrpe[898]: Allowing connections from: 10.*.*.*
Re: NRPE check_init_service returning: Unable to read output
Posted: Wed Apr 18, 2012 12:40 pm
by lmiltchev
I am not sure what version of Ubuntu you are running, but you can try editing this file (backup the file first, just in case something goes wrong!):
Code: Select all
sudo vi /etc/rsyslog.d/50-default.conf
Make sure that these two sections are uncommented:
Code: Select all
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none -/var/log/messages
daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
After you edit the file, run:
After this, you *should* be able to tail the /var/log/messages.
Re: NRPE check_init_service returning: Unable to read output
Posted: Wed Apr 18, 2012 1:09 pm
by GreatWolfResorts
Looks like making that change in /etc/rsyslog.d/50-default.conf and restarting the rsyslog did the trick. it generated the message log and allowed me to tail it. I ran the check again on the Nagios server and it now response appropriately:
Code: Select all
[root@noc libexec]# ./check_nrpe -H 10.*.*.* -c check_init_service -a cron
cron start/running, process 679
Looks like we can close the door on this one. Thanks everyone for your assistance!
Re: NRPE check_init_service returning: Unable to read output
Posted: Wed Apr 18, 2012 1:33 pm
by lmiltchev
I'm glad I could help!