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.

NRPE: Unable to read output

Postby natalia.fitsyk » Wed Oct 05, 2016 2:37 am

Hi,
I have a problem with my custom plugin.
I use nagios plugin jmeter.pl
Code: Select all
[root@client_nrpe ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_jmeter
NRPE: Unable to read output


output from more /etc/nagios/nrpe.cfg
Code: Select all
command[check_jmeter]=/usr/bin/sudo /usr/local/nagios/libexec/check_site.sh -w 1 -c 1


this is my script for jmeter:

Code: Select all
more /usr/local/nagios/libexec/check_site.sh
#!/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


Code: Select all
[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, /root/apache-jmeter-3.0/bin/jmeter.pl, /home/nagios/apache-jmeter-3.0/bin/jmeter.pl


Code: Select all
[root@client_nrpe ~]# ll /usr/local/nagios/libexec/check_site.sh
-rwxrwxrwx 1 nrpe nagios 570 Oct  3 18:14 /usr/local/nagios/libexec/check_site.sh


This is the output when I execute the script for check_site.sh:
Code: Select all
[root@client_nrpe ~]# /usr/local/nagios/libexec/check_site.sh
OK : sum:15730 : 15.73 seconds to complete.


This is the output from check_users
Code: Select all
[root@client_nrpe ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_users
USERS OK - 2 users currently logged in |users=2;5;10;0


Iptables and Selinux are off.

Can you help me please?
Thanks.
Natalia
Attachments
jmeter.pl
(5.45 KiB) Downloaded 26 times
Last edited by dwhitfield on Fri Nov 18, 2016 11:04 am, edited 2 times in total.
Reason: marking with green check mark
natalia.fitsyk
 
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Postby lgroschen » Wed Oct 05, 2016 2:02 pm

Hello!

This is a common mistake when creating your own plugin. All you should have to do to fix this would be to follow the developer guidelines on how generate nagios style output like this:
Code: Select all
'label'=value[UOM];[warn];[crit];[min];[max]


Here is the resource. I'm sure there is a lot of stuff in this document that will help you make more plugins: https://nagios-plugins.org/doc/guidelines.html#AEN200

Let us know how this turns out! Would be happy to help
/Luke
User avatar
lgroschen
 
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Fri Oct 07, 2016 8:00 am

Hi,
I edit the /etc/nagios/nrpe.cfg and change form value to "ARG"
from
command[check_jmeter]=/usr/bin/sudo /usr/local/nagios/libexec/check_site.sh -w 1 -c 1
to
command[check_jmeter]=/usr/bin/sudo /usr/local/nagios/libexec/check_site.sh -w $ARG1$ -c $ARG2$
restart nrpe but the output don't change:
[root@client_nrpe ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_jmeter
NRPE: Unable to read output
What is wrong?
Can you help me please?
Thank.
Natalia
natalia.fitsyk
 
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Postby lgroschen » Fri Oct 07, 2016 11:20 am

Try running through this doc, it might be a simple permission issue: https://assets.nagios.com/downloads/nagiosxi/docs/NRPE-Troubleshooting-and-Common-Solutions.pdf
/Luke
User avatar
lgroschen
 
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Tue Oct 11, 2016 7:12 am

Hi,
I have checked every suggestion about my check_custom but I don't find errors.
Can anyone help me please?
Thanks.
Natalia
natalia.fitsyk
 
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Postby rkennedy » Tue Oct 11, 2016 11:04 am

When you run the check_nrpe from the command line on the Nagios machine, please run tail -f /var/log/messages on your client machine. (might vary depending on your OS)

This will show us why the check is failing.
rkennedy
 
Posts: 6562
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Wed Oct 12, 2016 2:22 am

Hi,
I don't have any output on /var/log/messages when I run check_nrpe -H localhost -c check_jmeter :(
Thank.
Natalia
Last edited by dwhitfield on Fri Oct 14, 2016 10:42 am, edited 2 times in total.
Reason: editing code blocks
natalia.fitsyk
 
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Postby lmiltchev » Wed Oct 12, 2016 3:33 pm

I don't have any output on /var/log/messages when I run check_nrpe -H localhost -c check_jmeter :(

If you changed your command to:
Code: Select all
command[check_jmeter]=/usr/bin/sudo /usr/local/nagios/libexec/check_site.sh -w $ARG1$ -c $ARG2$

then you need to test it by running:
Code: Select all
./check_nrpe -H localhost -c check_jmeter -a 1 1

Note: "-a" is used to pass arguments. In this case, you are passing '1' for $ARG1$, and '1' for $ARG2$.

You have some entries in sudoers for the "nrpe" user. Do you actually have an "nrpe" user on this system? Can you test the command logged in as "nrpe" user?
Code: Select all
su 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
sudo /usr/local/nagios/libexec/check_site.sh -w 1 -c 1
./check_nrpe -H localhost -c check_jmeter -a 1 1
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 9475
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE: Unable to read output

Postby natalia.fitsyk » Thu Oct 13, 2016 4:08 am

Hi,
This is the output :
Code: Select all
[root@client_nrpe ~]# su nrpe
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
OK : sum:4806 : 4.806 seconds to complete.
bash-4.1$ sudo /usr/local/nagios/libexec/check_site.sh -w 1 -c 1
OK : sum:2131 : 2.131 seconds to complete.
bash-4.1$ ./check_nrpe -H localhost -c check_jmeter -a 1 1
bash: ./check_nrpe: Permission denied
bash-4.1$ sudo ./check_nrpe -H localhost -c check_jmeter -a 1 1
[sudo] password for nrpe:
sudo: ./check_nrpe: command not found
bash-4.1$ pwd


When I run from login with nrpe user :
Code: Select all
-bash-4.1$ pwd
/var/run/nrpe
-bash-4.1$ ./check_nrpe -H localhost -c check_jmeter
-bash: ./check_nrpe: No such file or directory
-bash-4.1$ ./check_nrpe -H localhost -c check_jmeter -a 1 1
-bash: ./check_nrpe: No such file or directory
-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
OK : sum:2427 : 2.427 seconds to complete.
-bash-4.1$ sudo /usr/local/nagios/libexec/check_site.sh -w 1 -c 1
OK : sum:2309 : 2.309 seconds to complete.
-bash-4.1$ ./check_nrpe -H localhost -c check_jmeter -a 1 1
-bash: ./check_nrpe: No such file or directory
-bash-4.1$ sudo ./check_nrpe -H localhost -c check_jmeter -a 1 1
[sudo] password for nrpe:
sudo: ./check_nrpe: command not found


Thanks a lot.
Natalia
Last edited by dwhitfield on Thu Oct 13, 2016 9:51 am, edited 1 time in total.
Reason: code blocks FTW
natalia.fitsyk
 
Posts: 29
Joined: Mon Aug 22, 2016 8:14 am

Re: NRPE: Unable to read output

Postby dwhitfield » Thu Oct 13, 2016 10:16 am

rkennedy wrote:(might vary depending on your OS)


What OS and version are you running? If CentOS, you can get your version from rpm --query centos-release.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3859
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Next

Return to Nagios Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests