监控MySQL主从同步状态
2016-09-14 13:55
639 查看
1. [root@A mysql]# cat check_slave_status.sh 2. #!/bin/sh 3. #-------------------------------------------- 4. #Author: Created by randolph 2016-08-17. 5. #Function: This scripts function is"Monitoring MySQL Master-Slave Status". 6. #Version:4.1.2 7. #--------------------------------------------- 8. 9. ERRORNO=(1158 1158 1008 1007 1062) 10. MySQL_CMD="mysql -uroot -p888888 -S /data/3308/mysql.sock" 11. while true 12. do 13. array=($($MySQL_CMD-e "show slave status\G"|egrep"Running|Behind_Master|Last_SQL_Errno"|awk-F ":" '{print $NF}')) 14. if [ "${array[0]}"== "Yes" -a "${array[1]}" == "Yes" -a "${array[2]}"== "0" ];then 15. echo"MySQL salve status is OK." 16. else 17. for ((i=0; i<${#ERRORNO[*]}; i++)) 18. do 19. if [ "${array[3]}"== "${ERRORNO[$i]}" ];then 20. $MySQL_CMD-e "stop slave;set globalsql_slave_skip_counter=1;start slave;" 21. fi 22. done 23. chars="MySQL salve status is FAIED." 24. echo"$chars" 25. echo"$chars"|mail -s "$chars" 813415154@qq.com 26. fi 27. sleep 3 28. done
相关文章推荐
- 利用 nagios 自带的插件来监控 mysql 的主从同步状态 (监控多实例)
- 监控mysql主从同步状态是否异常
- nagios 实现Mysql 主从同步状态的监控
- 监控mysql主从同步状态是否异常,如果异常,则发生短信或邮寄给管理员
- nagios 监控 mysql 主从同步状态
- shell脚本监控mysql主从同步状态并自动修复
- 监控mysql主从同步状态
- 监控mysql主从同步状态脚本
- nagios 监控 mysql 主从同步状态
- nagios 实现Mysql 主从同步状态的监控
- shell脚本监控mysql主从状态
- mysql主从同步监控小脚本
- Linux下MySQL主从同步监控shell脚本
- shell监控MySQL主从状态脚本制作及解析
- Shell脚本实现监控MySQL主从同步
- 自动监控主从MySQL同步的SHELL脚本
- Zabbix 监控Mysql 主从状态的Python脚本
- shell监控MySQL主从状态脚本两则 推荐
- Zabbix 监控Mysql 主从状态(Python脚本)
- shell监控MySQL主从状态脚本两则