zabbix监控mysql主从同步可用性

 

[test@test-cratedb-4nqdg11-prd zabbix_agentd.d]$ more mysql.conf 
UserParameter=check_sync_available,sh /etc/zabbix/scripts/check_sync_available.sh

 

[root@dev-env23 scripts]# more check_sync_available.sh
#!/bin/bash
check_time=`date "+%Y-%m-%d,%H:%M:%S"`
mysql -h 192.168.1.197 -urepl -pmysql -P13306 -e show slave status\G>/tmp/slave_197_13306.txt 2>&1

slave_io_running=`cat /tmp/slave_197_13306.txt|grep Slave_IO_Running|sed s/[[:space:]]//g|cut -d ‘:‘ -f2`
slave_sql_running=`cat /tmp/slave_197_13306.txt|grep Slave_SQL_Running|grep -v Slave_SQL_Running_State|sed s/[[:space:]]//g|cut -d ‘:‘ -f2`
##slave_io_running=bb
##slave_sql_running=aa

if [ "$slave_io_running" == "Yes" ] && [ "$slave_sql_running" == "Yes" ]; then
   echo "ok"
else
   echo "failed"
fi

 

zabbix监控mysql主从同步可用性

上一篇:LSM(Log Structured Merge Trees ) 笔记


下一篇:一文带你看透基于LSM-tree的NoSQL系统优化方向(到2020年为止 最全、最新)