Mysql database monitoring
Posted: Sat Jun 14, 2014 5:01 am
Hi
I am using nagios core 4.0.7 and I want to monitor mysql database but facing some problem
My client is running centos 6.5 and nrep.cfgconfig file is like this
command[check_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_var]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /var
command[check_home]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /home
#command[check_mysql]=/usr/local/nagios/libexec/check_mysql -d mysql -H localhost -u root -p testpass
command[check_mysql]=/usr/local/nagios/libexec/check_mysqld.pl
I have download check_mysqld.pl plugin from nagios plugin site and it working ok.
from client if run this command
[root@Titan libexec]# su - nagios
[nagios@Titan libexec]$ ls -l check_my*
-rwxr-xr-x 1 nagios nagios 183655 Jun 5 16:14 check_mysql
-rwxr-xr-x 1 nagios nagios 35326 Jun 13 22:33 check_mysqld.pl
-rwxr-xr-x 1 nagios nagios 170101 Jun 5 16:14 check_mysql_query
[nagios@Titan libexec]$ ./check_mysqld.pl
MYSQL 5.1.73 OK
[nagios@Titan libexec]$
[nagios@Titan libexec]$ /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_mysql
MYSQL 5.1.73 OK
[nagios@Titan libexec]$
My core server files are like this
server host.cfg file
define service{
use local-service ; Name of service template to use
host_name titan
service_description Root Partition
check_command check_nrpe!check_root
}
define service{
use generic-service ; Name of service template to use
host_name titan
service_description Mysql Database Status
check_command check_nrpe!check_mysql
server commands.cfg file
define command{
command_name check_nrpe
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
When I run command from server to client, output showing ok but monitoring showing error "NRPE: Command 'check_mysql' not "
[nagios@sov-srv-negios01 ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.128.28.222 -c check_mysql
MYSQL 5.1.73 OK
[nagios@sov-srv-negios01 ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.128.28.222 -c check_root
DISK OK - free space: / 2847 MB (60% inode=81%);| /=1824MB;3936;4428;0;4921
Root file system monitored without any problem only problem with mysql database.
My nagios core debugging logs out put
[1402739016.570360] [2048.1] [pid=30082] **** BEGIN MACRO PROCESSING ***********
[1402739016.570365] [2048.1] [pid=30082] Processing: '/usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$'
[1402739016.570379] [2048.1] [pid=30082] Done. Final output: '/usr/local/nagios/libexec/check_nrpe -H 10.128.156.122 -c check_mysql'
[1402739016.570386] [2048.1] [pid=30082] **** END MACRO PROCESSING *************
[1402739016.570394] [064.1] [pid=30082] Making callbacks (type 6)...
[1402739016.570410] [001.0] [pid=30082] macros_to_kvv()
[1402739016.570455] [001.0] [pid=30082] clear_volatile_macros_r()
[1402739016.570466] [001.0] [pid=30082] handle_timed_event() end
[1402739016.570473] [064.1] [pid=30082] Making callbacks (type 1)...
[1402739016.570481] [008.1] [pid=30082] ** Event Check Loop
[1402739016.570496] [008.1] [pid=30082] Next Event Time: Sat Jun 14 10:43:39 2014
[1402739016.570503] [008.1] [pid=30082] Current/Max Service Checks: 1/0 (inf% saturation)
[1402739016.570511] [12288.1] [pid=30082] ## Polling 1500ms; sockets=14; events=50; iobs=0xbc4140
[1402739016.585474] [001.0] [pid=30082] handle_async_service_check_result()
[1402739016.585503] [016.0] [pid=30082] ** Handling check result for service 'Mysql Database Status' on host 'titan' from 'Core Worker 30092'...
[1402739016.585512] [016.1] [pid=30082] HOST: titan, SERVICE: Mysql Database Status, CHECK TYPE: Active, OPTIONS: 0, SCHEDULED: Yes, RESCHEDULE: Yes, EXITED OK: Yes, RETURN CODE: 2, OUTPUT: NRPE: Command 'check_mysql' not defined
[1402739016.585527] [001.0] [pid=30082] get_service_check_return_code()
[1402739016.585534] [016.1] [pid=30082] Service is in a non-OK state!
[1402739016.585540] [016.1] [pid=30082] Host is currently UP, so we'll recheck its state to make sure...
[1402739016.585546] [001.0] [pid=30082] schedule_host_check()
[1402739016.585566] [016.0] [pid=30082] Scheduling a non-forced, active check of host 'titan' @ Sat Jun 14 10:43:36 2014
Thanks
Sanjay
I am using nagios core 4.0.7 and I want to monitor mysql database but facing some problem
My client is running centos 6.5 and nrep.cfgconfig file is like this
command[check_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_var]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /var
command[check_home]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /home
#command[check_mysql]=/usr/local/nagios/libexec/check_mysql -d mysql -H localhost -u root -p testpass
command[check_mysql]=/usr/local/nagios/libexec/check_mysqld.pl
I have download check_mysqld.pl plugin from nagios plugin site and it working ok.
from client if run this command
[root@Titan libexec]# su - nagios
[nagios@Titan libexec]$ ls -l check_my*
-rwxr-xr-x 1 nagios nagios 183655 Jun 5 16:14 check_mysql
-rwxr-xr-x 1 nagios nagios 35326 Jun 13 22:33 check_mysqld.pl
-rwxr-xr-x 1 nagios nagios 170101 Jun 5 16:14 check_mysql_query
[nagios@Titan libexec]$ ./check_mysqld.pl
MYSQL 5.1.73 OK
[nagios@Titan libexec]$
[nagios@Titan libexec]$ /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_mysql
MYSQL 5.1.73 OK
[nagios@Titan libexec]$
My core server files are like this
server host.cfg file
define service{
use local-service ; Name of service template to use
host_name titan
service_description Root Partition
check_command check_nrpe!check_root
}
define service{
use generic-service ; Name of service template to use
host_name titan
service_description Mysql Database Status
check_command check_nrpe!check_mysql
server commands.cfg file
define command{
command_name check_nrpe
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
When I run command from server to client, output showing ok but monitoring showing error "NRPE: Command 'check_mysql' not "
[nagios@sov-srv-negios01 ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.128.28.222 -c check_mysql
MYSQL 5.1.73 OK
[nagios@sov-srv-negios01 ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.128.28.222 -c check_root
DISK OK - free space: / 2847 MB (60% inode=81%);| /=1824MB;3936;4428;0;4921
Root file system monitored without any problem only problem with mysql database.
My nagios core debugging logs out put
[1402739016.570360] [2048.1] [pid=30082] **** BEGIN MACRO PROCESSING ***********
[1402739016.570365] [2048.1] [pid=30082] Processing: '/usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$'
[1402739016.570379] [2048.1] [pid=30082] Done. Final output: '/usr/local/nagios/libexec/check_nrpe -H 10.128.156.122 -c check_mysql'
[1402739016.570386] [2048.1] [pid=30082] **** END MACRO PROCESSING *************
[1402739016.570394] [064.1] [pid=30082] Making callbacks (type 6)...
[1402739016.570410] [001.0] [pid=30082] macros_to_kvv()
[1402739016.570455] [001.0] [pid=30082] clear_volatile_macros_r()
[1402739016.570466] [001.0] [pid=30082] handle_timed_event() end
[1402739016.570473] [064.1] [pid=30082] Making callbacks (type 1)...
[1402739016.570481] [008.1] [pid=30082] ** Event Check Loop
[1402739016.570496] [008.1] [pid=30082] Next Event Time: Sat Jun 14 10:43:39 2014
[1402739016.570503] [008.1] [pid=30082] Current/Max Service Checks: 1/0 (inf% saturation)
[1402739016.570511] [12288.1] [pid=30082] ## Polling 1500ms; sockets=14; events=50; iobs=0xbc4140
[1402739016.585474] [001.0] [pid=30082] handle_async_service_check_result()
[1402739016.585503] [016.0] [pid=30082] ** Handling check result for service 'Mysql Database Status' on host 'titan' from 'Core Worker 30092'...
[1402739016.585512] [016.1] [pid=30082] HOST: titan, SERVICE: Mysql Database Status, CHECK TYPE: Active, OPTIONS: 0, SCHEDULED: Yes, RESCHEDULE: Yes, EXITED OK: Yes, RETURN CODE: 2, OUTPUT: NRPE: Command 'check_mysql' not defined
[1402739016.585527] [001.0] [pid=30082] get_service_check_return_code()
[1402739016.585534] [016.1] [pid=30082] Service is in a non-OK state!
[1402739016.585540] [016.1] [pid=30082] Host is currently UP, so we'll recheck its state to make sure...
[1402739016.585546] [001.0] [pid=30082] schedule_host_check()
[1402739016.585566] [016.0] [pid=30082] Scheduling a non-forced, active check of host 'titan' @ Sat Jun 14 10:43:36 2014
Thanks
Sanjay