Page 4 of 4

Re: NRPE: Unable to read output

Posted: Wed Nov 16, 2016 7:46 am
by natalia.fitsyk
Hi,
[root@client_nrpe ~]# su nrpe
bash-4.1$ /usr/bin/sudo /usr/local/nagios/libexec/check_swap -w 20% -c 10%
SWAP OK - 100% free (4076 MB out of 4094 MB) |swap=4076MB;818;409;0;4094
bash-4.1$ /usr/local/nagios/libexec/check_swap -w 20% -c 10%
SWAP OK - 100% free (4076 MB out of 4094 MB) |swap=4076MB;818;409;0;4094

I delete sudo fo rcheck_swap and now working, but don't working check_jmeter, I delete sudo for check_jmeter too.

I think nrep user is right because I see into /var/log/messages this output :

Nov 16 13:34:52 client_nrpe nrpe[1154]: Running command: /usr/local/nagios/libexec/check_swap -w 20% -c 10%
Nov 16 13:34:52 client_nrpe nrpe[1154]: Command completed with return code 0 and output: SWAP OK - 100% free (4076 MB out of 4094 MB) |swap=4076MB;818;409;0;4094
Nov 16 13:34:52 client_nrpe nrpe[1154]: Return Code: 0, Output: SWAP OK - 100% free (4076 MB out of 4094 MB) |swap=4076MB;818;409;0;4094
Nov 16 13:34:52 client_nrpe nrpe[1154]: Connection from pn▒▒▒#177 closed.
Nov 16 13:35:01 client_nrpe nrpe[1181]: Connection from 10.10.10.10 port 19111
Nov 16 13:35:01 client_nrpe nrpe[1181]: Host address is in allowed_hosts
Nov 16 13:35:01 client_nrpe nrpe[1181]: Handling the connection...
Nov 16 13:35:01 client_nrpe nrpe[1181]: Host is asking for command 'check_jmeter' to be run...
Nov 16 13:35:01 client_nrpe nrpe[1181]: Running command: /usr/local/nagios/libexec/check_site.sh
Nov 16 13:35:01 client_nrpe nrpe[1181]: Command completed with return code 1 and output:
Nov 16 13:35:01 client_nrpe nrpe[1181]: Return Code: 1, Output: NRPE: Unable to read output
Nov 16 13:35:01 client_nrpe nrpe[1181]: Connection from pn▒▒▒#177 closed.

Thanks.
Natalia

Re: NRPE: Unable to read output

Posted: Wed Nov 16, 2016 10:12 am
by tgriep
Try doing the same test for the check_site.sh script.
Login to that remote host, run the following and post the errors.

Code: Select all

su nrpe
/usr/bin/sudo /usr/local/nagios/libexec/check_site.sh -w 15 -c 20
/usr/local/nagios/libexec/check_site.sh -w 15 -c 20

Re: NRPE: Unable to read output

Posted: Thu Nov 17, 2016 3:20 am
by natalia.fitsyk
Hi,
[root@client_nrpe ~]# su nrpe
bash-4.1$ /usr/bin/sudo /usr/local/nagios/libexec/check_site.sh -w 15 -c 20
OK : sum:2052 : 2.052 seconds to complete.
bash-4.1$ /usr/local/nagios/libexec/check_site.sh -w 15 -c 20
OK : sum:2144 : 2.144 seconds to complete.
bash-4.1$ sudo /usr/local/nagios/libexec/check_nrpe -H 10.10.10.10 -c check_jmeter
NRPE: Unable to read output
bash-4.1$ /usr/local/nagios/libexec/check_nrpe -H 10.10.10.10 -c check_jmeter
NRPE: Unable to read output

Thanks.
Natalia

Re: NRPE: Unable to read output

Posted: Thu Nov 17, 2016 11:47 am
by tgriep
Try and remove the sudo from the command in the /usr/local/nagios/libexec/check_site.sh script on the remote host and see if that works for you.

Re: NRPE: Unable to read output

Posted: Fri Nov 18, 2016 3:07 am
by natalia.fitsyk
Hi,
I try it but nothing, the output is same:

[root@client_nrpe ~]# su nrpe
bash-4.1$ /usr/local/nagios/libexec/check_nrpe -H localhost -c check_jmeter
NRPE: Unable to read output

[root@client_nrpe ~]# /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: Fri Nov 18, 2016 6:35 am
by natalia.fitsyk
Hi,
I solved my problem:
I put "Defaults:nrpe !requiretty " on the sudoers file config

[root@client_nrpe ~]# grep nrpe /etc/sudoers
Defaults:nrpe !requiretty

[root@client_nrpe ~]# /usr/local/nagios/libexec/check_nrpe -H 10.10.10.10 -c check_jmeter
OK : sum:2423 : 2.423 seconds to complete.

Thanks everyone.
Regards.
Natalia.

Re: NRPE: Unable to read output

Posted: Fri Nov 18, 2016 11:03 am
by dwhitfield
Glad to hear it is resolved. I am going to lock the thread. Please feel free to post again if you have you another issue. Thank you for using the Nagios forums!