Page 3 of 4

Re: NRPE: Unable to read output

Posted: Fri Oct 21, 2016 2:36 am
by natalia.fitsyk
Hi,
[root@cleint_nrpe~]# more /usr/local/nagios/libexec/check_site.sh
#!/bin/bash
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

Thanks.
Natalia

Re: NRPE: Unable to read output

Posted: Fri Oct 21, 2016 11:10 am
by dwhitfield
We will leave this open for community input. Unfortunately, we cannot fully support custom development.

Re: NRPE: Unable to read output

Posted: Wed Nov 02, 2016 2:55 am
by natalia.fitsyk
Any suggestions?
Thanks everyone.
Natalia.

Re: NRPE: Unable to read output

Posted: Wed Nov 02, 2016 9:40 am
by dwhitfield
Looking back through the thread, we never got a description of what it is you are trying to accomplish with your script. If you could explain that, we can help better with the script. Thanks!

Re: NRPE: Unable to read output

Posted: Thu Nov 03, 2016 3:54 am
by natalia.fitsyk
EDIT: Please use code tags

Hi,
I need to monitor my website, I created a jmeter test and now with help of nrpe I need to monitor my website.
Jmeter try to login and check availability from more parts of the site and check the response times.
ex:

Code: Select all

[root@client_nrpe ~]# /usr/local/nagios/libexec/check_site.sh
OK : sum:2542 : 2.542 seconds to complete.

Code: Select all

[root@client_nrpe ~]# su - nrpe
-bash-4.1$ sudo /usr/local/nagios/libexec/check_site.sh
+ sudo /usr/local/nagios/libexec/apache-jmeter-3.0/bin/jmeter.pl -j /usr/local/nagios/libexec/apache-jmeter-3.0/ -p /usr/local/nagios/libexec/apache-jmeter-3.0/bin/dermsl01_buono.jmx -w 15 -c 30
OK : sum:5656 : 5.656 seconds to complete.
-bash-4.1$ sudo  /usr/local/nagios/libexec/check_nrpe -H localhost -c check_jmeter
NRPE: Unable to read output
-bash-4.1$ sudo /usr/local/nagios/libexec/check_nrpe -H localhost -c check_users
USERS OK - 1 users currently logged in |users=1;5;10;0
-bash-4.1$ sudo /usr/local/nagios/libexec/check_nrpe -H localhost -c check_load
OK - load average: 0.00, 0.01, 0.00|load1=0.000;15.000;30.000;0; load5=0.010;10.000;25.000;0; load15=0.000;5.000;20.000;0;
Thanks.
Natalia

Re: NRPE: Unable to read output

Posted: Thu Nov 03, 2016 10:52 am
by mcapra
On the remote machine, can you share the contents of /usr/local/nagios/libexec/check_site.sh? Be sure to sanitize any JMX credentials in-use.

Can you also share the output of the following command from the remote machine's CLI:

ls -al /usr/local/nagios/libexec/

Re: NRPE: Unable to read output

Posted: Thu Nov 03, 2016 11:03 am
by natalia.fitsyk
[root@client_nrpe]# more /usr/local/nagios/libexec/check_site.sh
#!/bin/bash
sudo /usr/local/nagios/libexec/apache-jmeter-3.0/bin/jmeter.pl -j /usr/local/nagios/libexec/apache-jmeter-3.0/ -p /usr/local/nagios/libexec/apache-jmeter-3.0/bin/de_buono.jmx
I attached the list
"ls -al /usr/local/nagios/libexec/"

Thanks.
Natalia

Re: NRPE: Unable to read output

Posted: Fri Nov 04, 2016 12:49 pm
by tgriep
I see that you have debugging enabled in the nrpe.cfg file, when that command that creates the error is run, you you see any errors in the syslog files which are usually in the /var/log folder?
Another thing to try is to edit the script and put the full path to the sudo command and see if that helps.

Re: NRPE: Unable to read output

Posted: Tue Nov 08, 2016 7:54 am
by natalia.fitsyk
Hi,
1. there are the log :
Connection from localhost port 9097
Host address is in allowed_hosts
Handling the connection...
Host is asking for command 'check_jmeter' to be run...
Running command: /usr/bin/sudo /usr/local/nagios/libexec/check_site.sh
Command completed with return code 1 and output:
Return Code: 1, Output: NRPE: Unable to read output
Connection from ▒▒▒h▒#177 closed.
Connection from localhost port 9609
Host address is in allowed_hosts
Handling the connection...
Host is asking for command 'check_swap' to be run...
Running command: /usr/bin/sudo /usr/local/nagios/libexec/check_swap -w 20% -c 10%
Command completed with return code 1 and output:
Return Code: 1, Output: NRPE: Unable to read output
Connection from ▒▒▒h▒#177 closed.

I created new plugin for another test "check_swap" and I have the same output, I think I missing sudo but I don't know where.

But when I exec check_swap manualy the function is correctly:
[root@client_nrpe ~]# /usr/local/nagios/libexec/check_swap -w 20% -c 10%
SWAP OK - 100% free (4077 MB out of 4094 MB) |swap=4077MB;818;409;0;4094

2. Yes I try but the output is same.

Thanks.
Natalia

Re: NRPE: Unable to read output

Posted: Tue Nov 08, 2016 11:40 am
by tgriep
Try logging in to the remote system and change to the nrpe user by running

Code: Select all

su nrpe
Then run the command that you have defined in the nrpe.cfg line the example below.

Code: Select all

/usr/bin/sudo /usr/local/nagios/libexec/check_swap -w 20% -c 10%
You will probable see and error similar to below.
Sorry, user nrpe is not allowed to execute '/usr/local/nagios/libexec/check_swap -w 20% -c 10%' as root on localhost.localdomain.

If you see that error, try running it without sudo in the command like the following

Code: Select all

/usr/local/nagios/libexec/check_swap -w 20% -c 10%
If it works, remove the /usr/bin/sudo from your commands and that should fix it for you.

One thing to note, you are running the agent as the nrpe user and the plugins are installed as the nagios user account.
You may have to adjust the owner of the plugins to the nrpe user to get them to function.