Page 1 of 1

NRPE Issue

Posted: Thu May 24, 2012 3:33 am
by glennbtn
Hi All.

Running a Nagios server with verious clients running the NRPE plugin. I have a script for checking mysql replication. If I run it direct from the main Nagios server /usr/lib/nagios/plugins/check_nrpe -H monitored.com -c check_mysql NRPE: Unable to read output

If you run the following command from the host /usr/local/nagios/libexec/check-mysql-slave.pl
OK - Waiting for master to send event, replicating host xx.xx.xx.xx:3306

This is what is in the client nrpe.cfg command[check_sql]=/usr/local/nagios/libexec/check-mysql-slave.pl

This in on the nagios server

define service{
use generic-service
host_name server102.xxxxxx.co.uk
service_description # SQL replication
#contact_groups ux-admins, noc-op
check_command check_nrpe!check_sql
}

I have a similar script running for a memory check which did not work until I installed apt-get install bc on the Ubuntu box, although I did not see any errors in the syslog. Just wondering if I need something installed along these lines for it to be seen.

This is the debug details

May 24 09:21:44 slave nrpe[25294]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
May 24 09:21:44 slave nrpe[25294]: Handling the connection...
May 24 09:21:44 slave nrpe[25294]: Host is asking for command 'check_sql' to be run...
May 24 09:21:44 slave nrpe[25294]: Running command: /usr/local/nagios/libexec/check-mysql-slave.pl
May 24 09:21:44 slave nrpe[25294]: Command completed with return code 3 and output:
May 24 09:21:44 slave nrpe[25294]: Return Code: 3, Output: NRPE: Unable to read output


The file has the correct permissions and owner. Am a little confused where I may be going wrong here. Can anyone advise me

Re: NRPE Issue

Posted: Fri May 25, 2012 2:50 pm
by lmiltchev
Just to verify - are you running:

Code: Select all

/usr/lib/nagios/plugins/check_nrpe -H monitored.com -c check_mysql
or

Code: Select all

/usr/lib/nagios/plugins/check_nrpe -H monitored.com -c check_sql

Re: NRPE Issue

Posted: Tue Jun 12, 2012 5:07 am
by glennbtn
Sorry for the delay. Did not know I had a reply. I have been tweaking and playing since.

If I run the file directly on the host machine
/usr/local/nagios/libexec/check-mysql-slave.pl

I get the correct responce
OK - Waiting for master to send event, replicating host xx.xx.xx.xx:3306

When I run this using the NRPE check
/usr/local/nagios/libexec/check_nrpe -H localhost -c check-mysql-replication

I get NRPE: Unable to read output

I have the users on the file set as nagios as I should and I have the file set with the correct permissions

Re: NRPE Issue

Posted: Tue Jun 12, 2012 2:39 pm
by lmiltchev
What happens when you run on the client?

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H localhost
Do you get the NRPE version? For example:

Code: Select all

NRPE v2.12
Are you using xinetd?

Re: NRPE Issue

Posted: Wed Jun 13, 2012 2:05 am
by glennbtn
Thanks for the reply

When I run /usr/local/nagios/libexec/check_nrpe -H localhost

It do get NRPE v2.12

I have another script running on there checking memory and this works with no issues at all.

Thanks

Re: NRPE Issue

Posted: Wed Jun 13, 2012 2:50 am
by glennbtn
Opps sorry yes using xinetd

Re: NRPE Issue

Posted: Wed Jun 13, 2012 10:12 am
by agriffin
Do you get the correct response when running your script on the system locally as the nagios user?

Code: Select all

su nagios -s /bin/bash -c /usr/local/nagios/libexec/check-mysql-slave.pl

Re: NRPE Issue

Posted: Thu Jun 14, 2012 2:22 am
by glennbtn
Yes I get the correct responce

OK - Waiting for master to send event, replicating host xx.xx.xx.xx:3306

Thanks

Re: NRPE Issue

Posted: Thu Jun 14, 2012 10:14 am
by lmiltchev
Can you connect to your client from your nagios server?

Run the following commands in terminal on your nagios server and post the output:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <client_IP>

Code: Select all

nc -z <client_IP> 5666
or/and

Code: Select all

telnet <client_IP> 5666