I have installed Nagios® Core™ 3.5.1
and NRPE v2.14
on my client which running RHEL 6.3
I have this error message on my Nagios
NRPE: Command 'check_mysql_connections' not defined
On my nrpe.cfg
I already set up the allowed_host, include_dir
:
allowed_hosts=xx.xx.xx.xx
dont_blame_nrpe=1
include_dir=/etc/nagios/services
my command is on /etc/nagios/services/check_mysql_connections.cfg
command[check_mysql_connections]=/usr/lib64/nagios/plugins/check_mysql_all -K connections -H myHOST -u myUSERNAME -p myPASSWORD
On Nagios Server, I already set up the nagios.cfg
file, and add the commands-custom.cfg
on /etc/nagios/objects
which contains like this:
define command {
command_name check_mysql_connections
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mysql_connections
}
and on /etc/nagios/servers
I have add the mysql.cfg
## Define Host Group ##
define hostgroup {
hostgroup_name mysql-databases
alias MySQL Databases
}
#######################
## Define Hosts ##
define host {
use linux-server
host_name bdgbnbpmydb02
alias MySQL Database
address xx.xx.xx.xx
hostgroups mysql-databases
contact_groups admins
check_command check-host-alive
}
#######################
## Define Service ##
define service {
use generic-service
hostgroup_name mysql-databases
service_description MySQL Connections
check_command check_mysql_connections
}
I already kill the NRPE
process, removing /var/run/nrpe.pid
, and start the NRPE process again. And also my NRPE is NOT running under xinet.d
When I try to execute the command locally on the remote host, it gives result. And when I try to execute from the nagios server using this command:
/usr/lib64/nagios/plugins/check_nrpe -H xx.xx.xx.xx -c check_mysql_connections
it also gives result. I don't know what went wrong, because all of my other commands running normally.
UPDATE & SOLVED
after so many years, I recall how to solve this problem.
I need to edit the custom commands (on Nagios Server) commands-custom.cfg
on /etc/nagios/objects
, so it will be like this:
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
and under the "Define Service" it was like this:
## Define Service ##
define service {
use generic-service
hostgroup_name mysql-databases
service_description MySQL Connections
check_command check_nrpe!check_mysql_connections
}
In summarize, I need to separate the command to check the service to be check_nrpe
and call the custom commands using check_nrpe!check_mysql_connections
Reference: https://support.nagios.com/forum/viewtopic.php?f=7&t=33448