Nagios监控mysql主从复制

匿名 (未验证) 提交于 2019-12-02 22:06:11

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"|grepRunning |awk'{print $2}'))
if"${slave_is[0]}""Yes""${slave_is[1]}""Yes"]
then
echo"OK -slave is running"
exit0
else
echo"Critical -slave is error"
exit2
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.

https://www.cnblogs.com/xiewenming/p/7263283.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!