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

MySQL从服务器的监控

[[email protected]001 script]# ll
total 4
-rwxr-xr-x 1 root root 294 Jun 20 03:38 check_mysql_slave
[[email protected] script]# cat /software/script/check_mysql_slave
#!/bin/bash
declare -a slave_is
slave_is=($(mysql -uroot [email protected] -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

[[email protected] script]# ./check_mysql_slave
OK -slave isrunning

发表评论