首页未分类 › MySQL从服务器的监控

MySQL从服务器的监控

[root@db-server-61-001 script]# ll
total 4
-rwxr-xr-x 1 root root 294 Jun 20 03:38 check_mysql_slave
[root@db-server-61-001 script]# cat /software/script/check_mysql_slave
#!/bin/bash
declare -a slave_is
slave_is=($(mysql -uroot -pgb52054.GB@ -e “show slave status\G” |grep Running |awk ‘{print $2}’))
if [ “${slave_is[0]}” = “Yes” -a “${slave_is[1]}” = “Yes” ]
  then
  echo “OK -slave isrunning”
  exit 0
else
   echo “Critical -slave is error”
  exit 2
fi

[root@db-server-61-001 script]# ./check_mysql_slave
OK -slave isrunning

发表评论