返回顶部

收藏

mysql数据库主从状态同步监控脚本

更多
#!/bin/sh

slave_is=($(/data0/home/labnew/mysql/bin/mysql -umonitor -pmonitor -e "show slave status\G" | grep Rnning | awk '{print $2}'))

if [ "${slave_is[0]}" = "Yes" -a "${slave_is[1]}" = "Yes"]
then
    echo "OK slave is running"
    exit 0
else
    echo "Critical slave is stop"
    exit 2
fi

标签:shell,mysql,主从库,监控

收藏

0人收藏

支持

0

反对

0

发表评论