NRPE: Unable to read output
Posted: Fri Apr 24, 2020 5:23 am
I have this problem with NRPE. I'm trying to run check_oracle_health (https://labs.consol.de/nagios/check_oracle_health/) plugin through NRPE.
When i exicute the script it works:
/usr/local/nagios/libexec/check_oracle_health -t 240 --connect=DEV --user=nagios --password='xxxxxxxx' --mode=connected-users --warning 30 --critical 50 --method sqlplus
OK - 1 connected users | connected_users=1;30;50
but when I'm trying to run it through NRPE i got this error:
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c test
NRPE: Unable to read output
nrpe.cfg
log_facility=daemon
debug=0
pid_file=/usr/local/nagios/var/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
dont_blame_nrpe=1
allow_bash_command_substitution=0
command_timeout=60
connection_timeout=300
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 3.5 -c 4
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_data]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /mnt/data
command[check_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 500 -c 550
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
command[test]=sudo /usr/local/nagios/libexec/check_oracle_health -t 240 --connect=DEV --user=nagios --password='xxxxxxxx' --mode=connected-users --warning 30 --critical 50 --method sqlplus
i tried with /bin/sudo /usr/local/nagios/libexec/check_oracle_health -t 240 --connect=DEV --user=nagios --password='xxxxxxxx' --mode=connected-users --warning 30 --critical 50 --method sqlplus
and it still doesn't work.
Without sudo permission, it still doesn't work through NRPE
/etc/sudoers
nagios ALL=(ALL) NOPASSWD: ALL
getsebool -a | grep nagios
logging_syslogd_run_nagios_plugins --> on
nagios_run_pnp4nagios --> off
nagios_run_sudo --> on
nagios_use_nfs --> on
I edited check_oracle_health plugin adding these lines in the begin to always use specific environment:
$ENV{'ORACLE_HOME'}="/usr/lib/oracle/11.2/client64";
$ENV{'LD_LIBRARY_PATH'}="/usr/lib/oracle/11.2/client64/lib:/lib:/usr/lib";
$ENV{'TNS_ADMIN'}="/usr/lib/oracle/11.2/client64/network/admin";
Installed packages:
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
ps -ef | grep nrpe
nagios 27100 1 0 09:23 ? 00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f
/usr/local/nagios/libexec/check_nrpe --version
NRPE Plugin for Nagios
Version: 3.2.1
It works with other checks:
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_root
DISK OK - free space: / 15 GB (39.57% inode=96%);| /=23GB;30;34;0;38
With debug option set to 1 i got this log in /var/log/messages
Apr 24 10:16:35 app_server nrpe[28584]: CONN_CHECK_PEER: checking if host is allowed: 127.0.0.1 port 36042
Apr 24 10:16:35 app_server nrpe[28585]: WARNING: my_system() seteuid(0): Operation not permitted
Apr 24 10:16:35 app_server systemd: Created slice User Slice of root.
Apr 24 10:16:35 app_server systemd: Started Session c27 of user root.
Apr 24 10:16:36 app_server systemd: Removed slice User Slice of root.
Nrpe is installed from the Source. I used --enable-command-args with the installation
Thank you in advance.
Milos
When i exicute the script it works:
/usr/local/nagios/libexec/check_oracle_health -t 240 --connect=DEV --user=nagios --password='xxxxxxxx' --mode=connected-users --warning 30 --critical 50 --method sqlplus
OK - 1 connected users | connected_users=1;30;50
but when I'm trying to run it through NRPE i got this error:
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c test
NRPE: Unable to read output
nrpe.cfg
log_facility=daemon
debug=0
pid_file=/usr/local/nagios/var/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
dont_blame_nrpe=1
allow_bash_command_substitution=0
command_timeout=60
connection_timeout=300
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 3.5 -c 4
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_data]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /mnt/data
command[check_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 500 -c 550
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
command[test]=sudo /usr/local/nagios/libexec/check_oracle_health -t 240 --connect=DEV --user=nagios --password='xxxxxxxx' --mode=connected-users --warning 30 --critical 50 --method sqlplus
i tried with /bin/sudo /usr/local/nagios/libexec/check_oracle_health -t 240 --connect=DEV --user=nagios --password='xxxxxxxx' --mode=connected-users --warning 30 --critical 50 --method sqlplus
and it still doesn't work.
Without sudo permission, it still doesn't work through NRPE
/etc/sudoers
nagios ALL=(ALL) NOPASSWD: ALL
getsebool -a | grep nagios
logging_syslogd_run_nagios_plugins --> on
nagios_run_pnp4nagios --> off
nagios_run_sudo --> on
nagios_use_nfs --> on
I edited check_oracle_health plugin adding these lines in the begin to always use specific environment:
$ENV{'ORACLE_HOME'}="/usr/lib/oracle/11.2/client64";
$ENV{'LD_LIBRARY_PATH'}="/usr/lib/oracle/11.2/client64/lib:/lib:/usr/lib";
$ENV{'TNS_ADMIN'}="/usr/lib/oracle/11.2/client64/network/admin";
Installed packages:
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
ps -ef | grep nrpe
nagios 27100 1 0 09:23 ? 00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f
/usr/local/nagios/libexec/check_nrpe --version
NRPE Plugin for Nagios
Version: 3.2.1
It works with other checks:
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_root
DISK OK - free space: / 15 GB (39.57% inode=96%);| /=23GB;30;34;0;38
With debug option set to 1 i got this log in /var/log/messages
Apr 24 10:16:35 app_server nrpe[28584]: CONN_CHECK_PEER: checking if host is allowed: 127.0.0.1 port 36042
Apr 24 10:16:35 app_server nrpe[28585]: WARNING: my_system() seteuid(0): Operation not permitted
Apr 24 10:16:35 app_server systemd: Created slice User Slice of root.
Apr 24 10:16:35 app_server systemd: Started Session c27 of user root.
Apr 24 10:16:36 app_server systemd: Removed slice User Slice of root.
Nrpe is installed from the Source. I used --enable-command-args with the installation
Thank you in advance.
Milos