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

Error with check_uptime: NRPE: Unable to read output

Post by xerez »

This error appear when I try monitoring a Linux host with check_uptime:

In Nagios:
In my "linux.cfg" I have:

Code: Select all

define service{
        use                     generic-service
        host_name               name
        service_description     Uptime
        check_command           check_nrpe!check_uptime
        }
In my "commands.cfg" I added:

Code: Select all

# 'check_nrpe' command definition
define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }

# 'check_uptime' command definition
define command{
        command_name    check_uptime
        command_line    $USER1$/check_uptime -H $HOSTADDRESS$
        }
In my "nrpe.cfg" I added:

Code: Select all

command[check_uptime]=/usr/local/nagios/libexec/check_uptime -w 5 -c 10
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
In addition, when I execute this:

Code: Select all

./libexec/check_nrpe -H <host ip> -c check_uptime
The output is the same:

Code: Select all

NRPE: Unable to read output
But if I execute this:

Code: Select all

./libexec/check_nrpe -H localhost -c check_uptime
The output is:

Code: Select all

Uptime CRITICAL: 9 day(s) 1 hour(s) 37 minute(s) | uptime=13057.000000;5.000000;10.000000;
What's wrong or what's missing? Thanks.
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 »

NRPE on your remote host is not communicating with check_nrpe on your localhost. Your 2nd test is irrelevant, very rarely is there a need to `check_nrpe -H localhost`

Verify that the firewall port 5666 is open on the remote host
Verify that nrpe is running on the remote host
Verify that the nagios server's IP is listed in allowed_hosts in the remote host's nrpe.cfg
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

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

Post by xerez »

All are correct. Also, others services like "check_load" work fine.

In the Linux client, I see in "/usr/lib/nagios/plugins/" that don't there "check_uptime", can be the problem?

Thanks.
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 will need that plugin there, so put it there and see if that solves your issue. Generally it's a different error seen when plugins are missing, but it's worth a shot.

You can get all the Nagios plugins here:

http://www.nagios.org/download/plugins
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

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

Post by xerez »

Nothing, appear the same error.
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 »

Can the uptime command and see if you are even communicating with NRPE:

Code: Select all

[jdalrymple@localhost ~]$ /usr/local/nagios/libexec/check_nrpe -H <host ip>
I (0.4.3.131 2015-02-15) seem to be doing fine...
This was a windows host, but you should get some output similar just saying NRPE instead of the "0.4.3" business.

Also:

Code: Select all

[jdalrymple@localhost ~]$ nmap -p 5666 <host ip>
Starting Nmap 6.40 ( http://nmap.org ) at 2015-05-08 09:16 CDT
Nmap scan report for <host ip>
Host is up (0.0033s latency).
PORT     STATE SERVICE
5666/tcp open  nrpe

Nmap done: 1 IP address (1 host up) scanned in 1.25 seconds
If it doesn't say "open" under state - you have a service, network or firewall problem.
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

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

Post by xerez »

From Nagios server:

Code: Select all

nagios@localhost:~$ /usr/local/nagios/libexec/check_nrpe -H <host ip>
NRPE v2.13

Code: Select all

nagios@localhost:~$ nmap -p 5666 <host ip>

Starting Nmap 6.00 ( http://nmap.org ) at 2015-05-11 10:29 CEST
Nmap scan report for <host ip>
Host is up (0.0011s latency).
PORT     STATE SERVICE
5666/tcp open  nrpe

Nmap done: 1 IP address (1 host up) scanned in 0.38 seconds
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 »

xerez wrote:From Nagios server:

Code: Select all

nagios@localhost:~$ /usr/local/nagios/libexec/check_nrpe -H <host ip>
NRPE v2.13
This means your NRPE is working great and there is something haywire when it tries to execute the remote plugin.

Please post the relevent portion of your nrpe.cfg

Code: Select all

command[check_uptime]=<plugin path>check_uptime
and also

Code: Select all

ll <plugin path>
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

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

Post by xerez »

nrpe.cfg in Nagios:

Code: Select all

command[check_uptime]=/usr/local/nagios/libexec/check_uptime

Code: Select all

nagios@localhost:/usr/local/nagios/libexec$ ls -l check_uptime
-rwxr-xr-x 1 root nagios 129224 mar 28  2014 check_uptime
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 »

Weird.

As I go back through the post I don't see where that we've tested check_uptime since you put it on the remote server. Can you su to nagios and then run check_uptime from there?

Code: Select all

[jdalrymple@localhost ~]$ sudo su nagios
[sudo] password for jdalrymple:
[nagios@localhost jdalrymple]$ cd /usr/local/nagios/libexec
[nagios@localhost libexec]$ ./check_uptime
Uptime OK: 50 day(s) 17 hour(s) 7 minute(s) | uptime=73027.000000;;;
Locked