首页 运维 网络学院 查看内容

nagios监控mysql主从复制

2011-6-10 10:36 740 0

摘要:   环境:  Centos5.6 mysql只做同步指定库,没有同步mysql库用户数据  登陆从服务器mysql,添加验证的用户  grant replication client on *.* t...
关键词: check slave mysql notification nagios nrpe local interval 192.168 libexec

  环境:  Centos5.6 mysql只做同步指定库,没有同步mysql库用户数据  登陆从服务器mysql,添加验证的用户  grant replication client on *.* to 'nagios'@localhost identified by '123456';  flush privileges;  查看是否添加成功  select user,host from mysql.user  在从服务器安装 nrpe,然后在配置文件nrpe.cfg加入一行  command[check_mysql_slave]=/usr/local/nagios/libexec/check_mysql_slave  添加这个文件内容  #!/bin/sh  declare -a slave_is  slave_is=($(/usr/local/mysql/bin/mysql -unagios -p123456 -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 is error"  exit 2  fi  再执行这个脚本,观察输出情况  /usr/local/nagios/libexec/check_nrpe -H 192.168.10.231  /usr/local/nagios/libexec/check_nrpe -H 192.168.10.231 -c check_mysql_slave  在主监控服务里面添加了重启  define service {  host_name 192.168.10.232  service_description check_mysql_slave  check_period 24x7  max_check_attempts 5  normal_check_interval 3  retry_check_interval 2  contact_groups mygroup  notification_interval 5  notification_period 24x7  notification_options w,u,c,r  check_command check_nrpe!check_mysql_slave  }
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部