2

i am using Nrpe plugin on Ubuntu from nagios exchange check_mysql_slavestatus.

Manually its working from :

root@Bastion-01:/usr/local/nagios/libexec# ./check_mysql_slavestatus -H Slave-ip -P 3306 -u root -p xxxxx -w 10 -c 20

OK: Slave SQL running: Yes Slave IO running: Yes / master: 172.31.20.9 / slave is 0 seconds behind master | delay=0s

Similarly it works from Master DB

root@DB-01:/usr/lib/nagios/plugins# ./check_mysql_slavestatus -H Slave-ip  -P 3306 -u root -p xxxxx -w 10 -c 20

OK: Slave SQL running: Yes Slave IO running: Yes / master: 172.31.20.9 / slave is 0 seconds behind master | delay=0s

Getting Error

root@Bastion-01:/usr/local/nagios/libexec# ./check_nrpe -H Master-ip -c check_mysql_slavestatus  
NRPE: Unable to read output

On Nagios Server

In Command.cfg

define command{
        command_name check_mysql_slavestatus
        command_line $USER1$/check_mysql_slavestatus -H $HOSTADDRESS$ -P $ARG1$ -u $ARG2$ -p $ARG3$ -w $ARG4$ -c $ARG5$
}

vim /usr/local/nagios/etc/objects/nagios_DB1.cfg

define service{
        use                             generic-service 
        host_name                       DB-01
        service_description             check_mysql_slavestatus
     check_command check_nrpe!check_mysql_slavestatus!hostname!portnumber!username!passwd!15!50
}

Output On Nagios

check_mysql_slavestatus
CRITICAL    06-09-2015 13:51:51 0d 2h 45m 12s   3/3 (No output on stdout) stderr: execvp(/check_nrpe, ...) failed. errno is 2: No such file or directory 

Please let me know where i am wrong

Followed troubleshooting doc https://assets.nagios.com/downloads/nagiosxi/docs/NRPE-Troubleshooting-and-Common-Solutions.pdf

vim /etc/sudoers

nagios ALL= NOPASSWD: sudo /usr/lib/nagios/plugins/check_mysql_slavestatus
Ashish Karpe
  • 277
  • 2
  • 5
  • 19

1 Answers1

2

It looks like you don't fully understand how NRPE works. You do not have the check_nrpe plugin installed on your Nagios server, or the path to it is wrong. It's difficult to say for sure, without seeing your check_nrpe command definition.

Also, you seem somewhat confused about how to pass macros to check_nrpe...

check_nrpe!check_mysql_slavestatus!hostname!portnumber!username!passwd!15!50 means:

ARG1 = check_mysql_slavestatus
ARG2 = hostname
ARG3 = port
ARG4 = user
ARG5 = pass
ARG6 = 15
ARG7 = 50.

This is almost certainly not what you intend/want, unless your check_nrpe command takes 7 arguments (unlikely).

Changing that to something like check_nrpe!check_mysql_slavestatus hostname portnumber username passwd 15 50 would be more correct, but this will only work if you have configured NRPE to match. It must accept command arguments and your check_nrpe command definition must use -a $ARG1 at the end.

Furthermore, you need to define a check_mysql_slavestatus command that uses all of these arguments in the NRPE config on the remote end, not on the Nagios server.

It might help to read the NRPE documentation again.

Keith
  • 4,637
  • 15
  • 25