Nagios: 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.
Post Reply
MonatalBrowink
Posts: 3
Joined: Mon Sep 19, 2022 7:21 am

Nagios: NRPE: Unable to read output

Post by MonatalBrowink »

I have installed Nagios and NRPE plugins on the same server (CentOs 7).

The preinstalled services like check_disk work fine, but my manually intalled plugins always end up with following error:

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_cpu -a 20 10
NRPE: Unable to read output
/usr/local/nagios/etc/objects/localhost.cfg:

define service{
use local-service
host_name localhost
service_description CPU
check_command check_cpu!20!10
notifications_enabled 0
}
/usr/local/nagios/etc/objects/commands.cfg

define command {
command_name check_cpu
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_cpu -t 30 -a $ARG1$ $ARG2$
}
/usr/local/nagios/etc/nrpe.cfg

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20 -c 10
command[check_procs]=/usr/local/nagios/libexec/check_procs -w 30 -c 200
command[check_cpu]=/usr/local/nagios/libexec/check_cpu_perf.sh -w $ARG1$ -c $ARG2$
command[check_procs_cron]=/usr/local/nagios/libexec/check_procs -a cron
command[check_mem]=/usr/local/nagios/libexec/check_mem_ng.sh -w $ARG1$ -c $ARG2$
Output messages.log

Nov 29 19:52:03 localhost xinetd[25346]: START: nrpe pid=25575 from=::ffff:127.0.0.1
Nov 29 19:52:03 localhost nrpe[25575]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
Nov 29 19:52:03 localhost xinetd[25346]: EXIT: nrpe status=0 pid=25575 duration=0(sec)
additional information:

Output of /etc/xinetd.d/nrpe:

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = 127.0.0.1
}
Output from netstat -at | grep nrpe:

tcp 0 0 localhost:51424 localhost:nrpe TIME_WAIT
tcp6 0 0 [::]:nrpe [::]:* LISTEN
Does anyone have a hint? Thanks
evelynbarton
Posts: 1
Joined: Wed Jul 26, 2023 2:39 am

Re: Nagios: NRPE: Unable to read output

Post by evelynbarton »

Hi,
The error message "NRPE: Unable to read output" indicates that the NRPE plugin is not able to read the output from the check_cpu plugin. You can try disabling SELinux temporarily using the "setenforce 0" command to see if that resolves the issue. territorial io If it does, you may need to adjust your SELinux policies to allow NRPE to access the check_cpu plugin.
User avatar
swolf
Developer
Posts: 294
Joined: Tue Jun 06, 2017 9:48 am

Re: Nagios: NRPE: Unable to read output

Post by swolf »

Hi @MonatalBrowink, thanks for reaching out.

@evelynbarton's suggestion is pretty good - if you're using SELinux and don't have a policy for specifically for NRPE (which we don't provide in our own distributables), you can definitely run into the error you're seeing. If you absolutely need SELinux for this server, you can also look into installing NRPE via EPEL - I don't use their package myself, but my understanding is that they do include an SELinux policy that you can try.

If SELinux doesn't seem to be the issue, you may want to look at the permissions for your custom plugins. You said the preinstalled services work fine, which makes me think that your custom scripts may not be runnable by the NRPE daemon.

As an aside, I moved this thread to the open-source section, since it seems to be about just NRPE and not any of our paid products.

Let me know if either of those solutions help, or if you have any further questions or concerns

-Sebastian Wolf
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy
Post Reply