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/shdeclareslave_is=($(/usr/local/mysql/bin/mysql"show slave status\G"|grepRunning |awk'{print $2}'))if"${slave_is[0]}""Yes""${slave_is[1]}""Yes"]thenecho"OK -slave is running"exit0elseecho"Critical -slave is error"exit2fi |
[[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_slavecheck_command check_nrpe!check_mysql_slavemax_check_attempts 4normal_check_interval 3retry_check_interval 2check_period 24x7notification_interval 10notification_period 24x7notification_options w,u,c,rcontact_groups zhaowei} |
1 2 3 4 | [[email protected]_BJ__Nagios ~]# service nagios restartRunning configuration check...done.done.done. |
文章来源: Nagios监控mysql主从复制