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.
natalia.fitsyk
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Post by natalia.fitsyk »

Hi,
[root@client_nrpe ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
2.6.32-573.7.1.el6.x86_64
Thanks.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NRPE: Unable to read output

Post by dwhitfield »

Could you post the output of ls -la /usr/local/nagios/libexec?

This is the piece I don't understand at the moment: sudo: ./check_nrpe: command not found paired with [root@client_nrpe ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_users
natalia.fitsyk
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Post by natalia.fitsyk »

Hi,
ls -la /usr/local/nagios/libexec/ > libexec.txt (see attached file)

[root@client ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_users
USERS OK - 1 users currently logged in |users=1;5;10;0

sudo: ./check_nrpe: command not found

When I try to run the command ./check_nrpe by logging in with user nrpe I have this output:
./check_nrpe: command not found

Because the home directory for user nrpe is /var/run/nrpe

[root@client_nrpe ~]# grep nrpe /etc/passwd
nrpe:x:500:502::/var/run/nrpe:/bin/bash

bash-4.1$ sudo ./check_nrpe
[sudo] password for nrpe:
sudo: ./check_nrpe: command not found
-bash-4.1$ pwd
/var/run/nrpe

Thanks.
:)
Attachments
libexec.txt
(3.93 KiB) Downloaded 425 times
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NRPE: Unable to read output

Post by dwhitfield »

You just need to add that directory to the nrpe user's PATH. Please let us know if you have any questions after looking through http://www.troubleshooters.com/linux/prepostpath.htm
natalia.fitsyk
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Post by natalia.fitsyk »

Hi,
I added on PATH for nrpe user: /usr/local/nagios/libexec
-bash-4.1$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/var/run/nrpe/bin:/usr/local/nagios/libexec
-bash-4.1$ whoami
nrpe

But don't solved a problem:
-bash-4.1$ /usr/local/nagios/libexec/check_nrpe -H localhost -c check_jmeter
NRPE: Unable to read output
-bash-4.1$ /usr/local/nagios/libexec/check_nrpe -H localhost -c check_users
USERS OK - 2 users currently logged in |users=2;5;10;0

Thanks.
Natalia.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NRPE: Unable to read output

Post by dwhitfield »

Are you running NRPE through xinetd or stand-alone? If the second, did you allow it through the firewall? Did you add the server's IP into your allowed_from in your nrpe.cfg?
natalia.fitsyk
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Post by natalia.fitsyk »

Hi,
[root@client_nrpe ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@client_nrpe ~]# /etc/init.d/ip6tables status
ip6tables: Firewall is not running.
Selinux is off

NRPE is stand-alone service.
IP is allowed because another check_xx are running correctly.

[root@client_nrpe ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_load
OK - load average: 0.00, 0.00, 0.00|load1=0.000;15.000;30.000;0; load5=0.000;10.000;25.000;0; load15=0.000;5.000;20.000;0;

Thanks.
Natalia.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE: Unable to read output

Post by rkennedy »

I believe the problem is with permissions due to the sudo in multiple places here -

Code: Select all

    #!/bin/bash
    sudo -u nrpe sudo /home/nagios/apache-jmeter-3.0/bin/jmeter.pl -j /home/nagios/apache-jmeter-3.0/ -p /home/nagios/apache-jmeter-3.0/bin/dermsl01_buono.jmx
Could you attempt the following from the client side?

Code: Select all

su - nagios
/usr/bin/sudo /usr/local/nagios/libexec/check_site.sh -w 1 -c 1
(not sure why you're passing -w 1 and -c 1 when they are not passed in check_site.sh anywhere)

Let us know the error you receive when trying to run it, and also post your /etc/sudoers.
Former Nagios Employee
natalia.fitsyk
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Post by natalia.fitsyk »

Hi,

Code: Select all

-bash-4.1$ sudo /home/nagios/apache-jmeter-3.0/bin/jmeter.pl -j /home/nagios/apache-jmeter-3.0/ -p /home/nagios/apache-jmeter-3.0/bin/dermsl01_buono.jmx -w 15 -c 30
OK : sum:2309 : 2.309 seconds to complete.
-bash-4.1$ pwd
/var/run/nrpe
-bash-4.1$ whoami
nrpe

-bash-4.1$ grep check_jmeter /etc/nagios/nrpe.cfg
command[check_jmeter]=/usr/bin/sudo /usr/local/nagios/libexec/check_site.sh -w $ARG1$ -c $ARG2$

[root@client_nrpe ~]# grep nrpe /etc/sudoers
nrpe          ALL=(ALL) NOPASSWD: /usr/local/nagios/libexec/check_jmeter, /usr/local/nagios/libexec/check_nrpe, /usr/local/nagios/libexec/check_site.sh, /usr/local/nagios/libexec/script_jmeter.sh, /home/nagios/apache-jmeter-3.0/bin/jmeter, /home/nagios/apache-jmeter-3.0/bin/jmeter.pl, /home/nagios/apache-jmeter-3.0/bin/dermsl01_buono.jmx

-bash-4.1$ /usr/bin/sudo /usr/local/nagios/libexec/check_site.sh -w $ARG1$ -c $ARG2$
OK : sum:2265 : 2.265 seconds to complete.

-bash-4.1$ cd /home/nagios/apache-jmeter-3.0/bin/
-bash-4.1$ sudo ./jmeter.pl -j /home/nagios/apache-jmeter-3.0/ -p /home/nagios/apache-jmeter-3.0/bin/dermsl01_buono.jmx
OK : sum:2122 : 2.122 seconds to complete.

-bash-4.1$ /usr/bin/sudo /usr/local/nagios/libexec/check_site.sh
OK : sum:2241 : 2.241 seconds to complete.
But

Code: Select all

-bash-4.1$ /usr/local/nagios/libexec/check_nrpe -H localhost -c check_jmeter
NRPE: Unable to read output
:(

Thanks.
Natalia.
Last edited by tmcdonald on Thu Oct 20, 2016 4:50 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NRPE: Unable to read output

Post by ssax »

Please attach your nrpe.cfg file and also the jmeter.pl script, it may have to do with it not having the correct paths (meaning running from CLI manually will already have the paths set, when it runs as a service it may have different paths).


Thank you
Locked