Page 2 of 4
Re: NRPE: Unable to read output
Posted: Fri Oct 14, 2016 1:59 am
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.
Re: NRPE: Unable to read output
Posted: Fri Oct 14, 2016 10:50 am
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
Re: NRPE: Unable to read output
Posted: Mon Oct 17, 2016 2:01 am
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
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.
Re: NRPE: Unable to read output
Posted: Mon Oct 17, 2016 9:39 am
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
Re: NRPE: Unable to read output
Posted: Tue Oct 18, 2016 4:48 am
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.
Re: NRPE: Unable to read output
Posted: Tue Oct 18, 2016 10:36 am
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?
Re: NRPE: Unable to read output
Posted: Wed Oct 19, 2016 2:20 am
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.
Re: NRPE: Unable to read output
Posted: Wed Oct 19, 2016 1:16 pm
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.
Re: NRPE: Unable to read output
Posted: Thu Oct 20, 2016 2:29 am
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.
Re: NRPE: Unable to read output
Posted: Thu Oct 20, 2016 4:55 pm
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