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 21, 2016 2:36 am

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
Attachments
jmeter.pl
(5.25 KiB) Downloaded 14 times
nrpe.cfg
(7.93 KiB) Downloaded 20 times
natalia.fitsyk
 
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Postby dwhitfield » Fri Oct 21, 2016 11:10 am

We will leave this open for community input. Unfortunately, we cannot fully support custom development.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3107
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Wed Nov 02, 2016 2:55 am

Any suggestions?
Thanks everyone.
Natalia.
natalia.fitsyk
 
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Postby dwhitfield » Wed Nov 02, 2016 9:40 am

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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3107
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Thu Nov 03, 2016 3:54 am

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

Re: NRPE: Unable to read output

Postby mcapra » Thu Nov 03, 2016 10:52 am

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/
Former Nagios employee - https://github.com/mcapra/
User avatar
mcapra
 
Posts: 2466
Joined: Thu May 05, 2016 3:54 pm

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Thu Nov 03, 2016 11:03 am

[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
Attachments
listanrpe.txt
(4.16 KiB) Downloaded 17 times
natalia.fitsyk
 
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Postby tgriep » Fri Nov 04, 2016 12:49 pm

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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5365
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Tue Nov 08, 2016 7:54 am

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

Re: NRPE: Unable to read output

Postby tgriep » Tue Nov 08, 2016 11:40 am

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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5365
Joined: Thu Oct 30, 2014 9:02 am

PreviousNext

Return to Nagios Plugin Development

Who is online

Users browsing this forum: No registered users and 5 guests