Nagios 监控Mysql同步状态
2012-07-09 22:19
435 查看
每一步、在mysql从服务器的数据库上建立用户名和密码,仅给replication client权限。
第二步,在被监控的Mysql从服务器上建立脚本Check-mysql-slave
#!/bin/sh
declare -a slave_is
slave_is=($(/usr/local/mysql/bin/mysql -unagios -p****** -e "show slave status\G"|grep Running |awk '{print $2}'))
if [ "${slave_is[0]}" = "Yes" -a "${slave_is[1]}" = "Yes" ]
then
echo "OK slave is running"
exit 0
else
echo "Critical slave be stoped"
exit 2
fi
第三步、在mysql从服务器上的Nrpe。cfg上加以下命令。
command[check_mysql_slave]=/usr/local/nagios/libexec/check_mysql_slave
其它的设置与对Linux的监控一样了。
下面在nagios配置文件
vi /usr/local/nagios/services/nagios.conf
define service{
use service
host_name 被监控段的IP 地址必须有nrpe
service_description check_mysql_slave nagios显示的名字
check_command check_nrpe!check_mysql_slave 查找的插件
notification_options w,u,c,r 状态
contact_groups 联系组
}
vi /usr/local/nagios/hosts/nagios.conf
define host{
use host
host_name IP
alias check_alive
address IP
contact_groups 组
}
第二步,在被监控的Mysql从服务器上建立脚本Check-mysql-slave
#!/bin/sh
declare -a slave_is
slave_is=($(/usr/local/mysql/bin/mysql -unagios -p****** -e "show slave status\G"|grep Running |awk '{print $2}'))
if [ "${slave_is[0]}" = "Yes" -a "${slave_is[1]}" = "Yes" ]
then
echo "OK slave is running"
exit 0
else
echo "Critical slave be stoped"
exit 2
fi
第三步、在mysql从服务器上的Nrpe。cfg上加以下命令。
command[check_mysql_slave]=/usr/local/nagios/libexec/check_mysql_slave
其它的设置与对Linux的监控一样了。
下面在nagios配置文件
vi /usr/local/nagios/services/nagios.conf
define service{
use service
host_name 被监控段的IP 地址必须有nrpe
service_description check_mysql_slave nagios显示的名字
check_command check_nrpe!check_mysql_slave 查找的插件
notification_options w,u,c,r 状态
contact_groups 联系组
}
vi /usr/local/nagios/hosts/nagios.conf
define host{
use host
host_name IP
alias check_alive
address IP
contact_groups 组
}
相关文章推荐
- nagios 监控 mysql 主从同步状态
- nagios 监控 mysql 主从同步状态
- nagios 实现Mysql 主从同步状态的监控
- nagios 实现Mysql 主从同步状态的监控
- 利用 nagios 自带的插件来监控 mysql 的主从同步状态 (监控多实例)
- 使用Linux C开发Nagios监控插件系列——监控MySQL状态的插件开发
- nagios监控mysql状态
- nagios监控mysql主从状态
- 使用Linux C开发Nagios监控插件系列——监控MySQL状态的插件开发
- mysql 主从备份监控slave状态nagios脚本
- Nagios监控mysql同步
- nagios监控之四配置监控web服务,端口,mysql等状态
- nagios监控mysql主从状态的简单脚本
- shell脚本监控mysql主从同步状态并自动修复
- shell脚本:nagios监控mysql同步
- 监控mysql主从同步状态脚本
- 监控mysql主从同步状态
- 监控MySQL主从同步状态
- nagios 监控tcp连接数 物理内存 cpu使用率 web并发数 mysql主从状态
- 监控mysql主从同步状态是否异常,如果异常,则发生短信或邮寄给管理员