1 |
"show slave stutas\G" |
1 | command [check_mysql_slave]= /usr/local/nagios-nrpe/libexec/chech_mysql_slave |
1 2 3 4 5 6 7 8 9 10 11 | #!/bin/sh declare
slave_is=($( /usr/local/mysql/bin/mysql
"show slave status\G" | grep Running | awk '{print $2}' )) if
"${slave_is[0]}"
"Yes"
"${slave_is[1]}"
"Yes" ]
then
echo "OK -slave is running"
exit 0 else
echo "Critical -slave is error"
exit 2 fi |
[[email protected] ~]#/usr/local/nagios-nrpe/libexec/check_mysql_slave
OK -slave is running
1 2 3 4 5 6 7 8 9 10 11 12 13 | define service{
service_description check_mysql_slave
check_command check_nrpe!check_mysql_slave
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
contact_groups zhaowei
} |
1 2 3 4 | [[email protected]_BJ__Nagios ~] # service nagios restart Running configuration check... done .
done .
done . |
文章来源: Nagios监控mysql主从复制