Page 1 of 4

Error with check_uptime: NRPE: Unable to read output

Posted: Wed May 06, 2015 6:04 am
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.

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

Posted: Wed May 06, 2015 9:31 am
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

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

Posted: Thu May 07, 2015 2:30 am
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.

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

Posted: Thu May 07, 2015 9:24 am
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

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

Posted: Fri May 08, 2015 2:49 am
by xerez
Nothing, appear the same error.

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

Posted: Fri May 08, 2015 9:17 am
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.

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

Posted: Mon May 11, 2015 3:36 am
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

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

Posted: Mon May 11, 2015 10:00 am
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>

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

Posted: Tue May 12, 2015 3:14 am
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

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

Posted: Tue May 12, 2015 7:41 am
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;;;