NRPE Issue

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
glennbtn
Posts: 7
Joined: Mon Dec 12, 2011 11:53 am

NRPE Issue

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE Issue

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
glennbtn
Posts: 7
Joined: Mon Dec 12, 2011 11:53 am

Re: NRPE Issue

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE Issue

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
glennbtn
Posts: 7
Joined: Mon Dec 12, 2011 11:53 am

Re: NRPE Issue

Post 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
glennbtn
Posts: 7
Joined: Mon Dec 12, 2011 11:53 am

Re: NRPE Issue

Post by glennbtn »

Opps sorry yes using xinetd
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: NRPE Issue

Post 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
glennbtn
Posts: 7
Joined: Mon Dec 12, 2011 11:53 am

Re: NRPE Issue

Post by glennbtn »

Yes I get the correct responce

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

Thanks
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE Issue

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked