zabbix监控mysql_slave状态

业无高卑志当坚,男儿有求安得闲?这篇文章主要讲述zabbix监控mysql_slave状态相关的知识,希望能为你提供帮助。
cat /etc/zabbix/script/mysql_slave_status.sh

#!/bin/bashUSER="root" PASSWD="xxx" NAME=$1function IO { Slave_IO_Running=`mysql -u $USER -p$PASSWD -e "show slave status\\G; " 2> /dev/null |grep Slave_IO_Running |awk \'{print $2}\'` if [ $Slave_IO_Running == "Yes" ]; then echo 0 else echo 1 fi }function SQL { Slave_SQL_Running=`mysql -u $USER -p$PASSWD -e "show slave status\\G; " 2> /dev/null |grep Slave_SQL_Running: |awk \'{print $2}\'` if [ $Slave_SQL_Running == "Yes" ]; then echo 0 else echo 1 fi}case $NAME in io) IO ; ; sql) SQL ; ; *) echo -e "Usage: $0 [io | sql]" esac

cat /etc/zabbix/zabbix_agentd.d/userparameter_mysql_slave.conf
# 获取MySQL slave状态 UserParameter=mysql.slave[*],/etc/zabbix/script/mysql_slave_status.sh $1

【zabbix监控mysql_slave状态】

    推荐阅读