NRPE: Unable to read output

This forum is intended for the discussion of Nagios plugin development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The SourceForge.net nagiosplug-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Fri Oct 14, 2016 1:59 am

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

Re: NRPE: Unable to read output

Postby dwhitfield » Fri Oct 14, 2016 10:50 am

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
https://support.nagios.com/forum/viewtopic.php?f=6&t=1274 says XI at the top, but it more-or-less applies to everything.
User avatar
dwhitfield
Support Tech
 
Posts: 1809
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Mon Oct 17, 2016 2:01 am

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

Re: NRPE: Unable to read output

Postby dwhitfield » Mon Oct 17, 2016 9:39 am

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
https://support.nagios.com/forum/viewtopic.php?f=6&t=1274 says XI at the top, but it more-or-less applies to everything.
User avatar
dwhitfield
Support Tech
 
Posts: 1809
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Tue Oct 18, 2016 4:48 am

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

Re: NRPE: Unable to read output

Postby dwhitfield » Tue Oct 18, 2016 10:36 am

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?
https://support.nagios.com/forum/viewtopic.php?f=6&t=1274 says XI at the top, but it more-or-less applies to everything.
User avatar
dwhitfield
Support Tech
 
Posts: 1809
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Wed Oct 19, 2016 2:20 am

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

Re: NRPE: Unable to read output

Postby rkennedy » Wed Oct 19, 2016 1:16 pm

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.
rkennedy
 
Posts: 6503
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Thu Oct 20, 2016 2:29 am

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

Re: NRPE: Unable to read output

Postby ssax » Thu Oct 20, 2016 4:55 pm

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
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
ssax
Dreams In Code
 
Posts: 2733
Joined: Wed Feb 11, 2015 12:54 pm

PreviousNext

Return to Nagios Plugin Development

Who is online

Users browsing this forum: No registered users and 1 guest