Error with check_uptime: NRPE: Unable to read output

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

Re: Error with check_uptime: NRPE: Unable to read output

Post by xerez »

Code: Select all

nagios@localhost:/usr/local/nagios/libexec$ sudo su nagios
[sudo] password for nagios:
Sorry, user nagios is not allowed to execute '/bin/su nagios' as root on localhost.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Error with check_uptime: NRPE: Unable to read output

Post by jdalrymple »

You're already the nagios user - just execute /usr/local/nagios/libexec/check_uptime
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

Re: Error with check_uptime: NRPE: Unable to read output

Post by xerez »

Sorry.

Code: Select all

nagios@localhost:/usr/local/nagios/libexec$ ./check_uptime
Uptime OK: 15 day(s) 21 hour(s) 54 minute(s) | uptime=22914.000000;;;
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Error with check_uptime: NRPE: Unable to read output

Post by Box293 »

In your original post:
In the Linux host:
In my "nrpe.cfg" I added:

Code: Select all

command[check_uptime]=/usr/local/nagios/libexec/check_uptime -w 5 -c 10
A couple of posts ago:
xerez wrote:nrpe.cfg in Nagios:

Code: Select all

command[check_uptime]=/usr/local/nagios/libexec/check_uptime
Have you restarted xinetd on the remote host since making these changes?

Code: Select all

service xinetd restart
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

Re: Error with check_uptime: NRPE: Unable to read output

Post by xerez »

The nrpe.cfg on Nagios, never it changed, only I omitted the unnecessary part.

nrpe.cfg on Nagios:

Code: Select all

command[check_uptime]=/usr/local/nagios/libexec/check_uptime -w 5 -c 10
At this moment in the nrpe.cfg on the Linux host, I have:

Code: Select all

command[check_uptime]=/usr/local/nagios/libexec/check_uptime -w 5 -c 10
However, I don't have installed xinetd in the Linux host. It is necessary?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Error with check_uptime: NRPE: Unable to read output

Post by jdalrymple »

Sounds like we need to do some regrouping:
xerez wrote:nrpe.cfg on Nagios:

Code: Select all

command[check_uptime]=/usr/local/nagios/libexec/check_uptime -w 5 -c 10
On the nagios server nrpe.cfg is irrelevant. You do not need to modify it for any reason.

Let's get a clean run and please post your command and the output in code blocks here for our review. Before doing that though lets change nrpe.cfg on the linux server.

Code: Select all

# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on

debug=1
Change debug to 1 (if it's not already) so that we're logging. You'll also need to restart nrpe - which brings me to your question:
xerez wrote:However, I don't have installed xinetd in the Linux host. It is necessary?
Not if this:
xerez wrote:

Code: Select all

nagios@localhost:~$ /usr/local/nagios/libexec/check_nrpe -H <host ip>
NRPE v2.13
is accurate. Let's verify - when you did this you used the the remote Linux server's IP in <host ip> right?

That said - to restart nrpe if it's daemonized you can HUP it, or maybe you have an init script?

Code: Select all

/etc/init.d/nrpe restart
If none of that makes sense, post the output of

Code: Select all

ps -ef | grep nrpe
and we'll figure it out for you.
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

Re: Error with check_uptime: NRPE: Unable to read output

Post by xerez »

Well, when I execute this:

Code: Select all

nagios@localhost:~$ /usr/local/nagios/libexec/check_nrpe -H <host ip>
NRPE v2.13
I use the IP of remote Linux host. It's more, other checks like CPU load, memory usage, ping and SSH work.

Moreover, when I installed nrpe in this host, I used this:

Code: Select all

apt-get install nagios-nrpe-server nagios-plugins-basic nagios-plugins
So when I want restart nrpe, I use:

Code: Select all

usuario@linux:/etc/nagios$ /etc/init.d/nagios-nrpe-server restart
[....] Stopping nagios-nrpe: nagios-nrpestart-stop-daemon: warning: failed to kill 8794: No such process
. ok
[ ok ] Starting nagios-nrpe: nagios-nrpe.
Now I see that warning, sorry.

Anyway:

Code: Select all

usuario@linux:/etc/nagios$ ps -ef | grep nrpe
nagios   15067     1  0 may08 ?        00:01:15 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
usuario  16261 15868  0 09:32 pts/0    00:00:00 grep nrpe
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Error with check_uptime: NRPE: Unable to read output

Post by jdalrymple »

Did you change the debug level? If so, re-run your check_nrpe -c check_uptime and post the tail of /var/log/messages for us to review please.

Thanks.
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

Re: Error with check_uptime: NRPE: Unable to read output

Post by xerez »

It doesn't shows nothing...

nrpe.cfg on Linux host:

Code: Select all

usuario@linux:~$ cat /etc/nagios/nrpe.cfg
....
# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on

debug=1
....
And also I restart NRPE with:

Code: Select all

usuario@linux:~$ su -c "/etc/init.d/nagios-nrpe-server restart" 
I run this in Nagios:

Code: Select all

nagios@localhost:/usr/local/nagios/libexec$ check_nrpe -H <host ip> -c check_uptime
NRPE: Unable to read output
After, I read /var/log/messages and nothing:

Code: Select all

usuario@linux:~$ su -c "tail /var/log/messages"                                
Contraseña:
May 18 07:48:43 debian mpt-statusd: detected non-optimal RAID status
May 18 07:58:43 debian mpt-statusd: detected non-optimal RAID status
May 18 08:08:43 debian mpt-statusd: detected non-optimal RAID status
May 18 08:18:53 debian mpt-statusd: detected non-optimal RAID status
May 18 08:28:53 debian mpt-statusd: detected non-optimal RAID status
May 18 08:38:53 debian mpt-statusd: detected non-optimal RAID status
May 18 08:48:53 debian mpt-statusd: detected non-optimal RAID status
May 18 08:58:53 debian mpt-statusd: detected non-optimal RAID status
May 18 09:08:53 debian mpt-statusd: detected non-optimal RAID status
May 18 09:18:53 debian mpt-statusd: detected non-optimal RAID status
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Error with check_uptime: NRPE: Unable to read output

Post by jdalrymple »

What are you other logging options, particularly "log_facility"?

NRPE will always log something, especially when restarting, and especially if debug is on.

Code: Select all

May 18 05:29:30 localhost nrpe[10348]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
May 18 05:29:30 localhost nrpe[10349]: Starting up daemon
Locked