#!/bin/bash lag=$(mysql -umonitor -pmonitor -h 127.0.0.1 -e "show slave status\G" | grep Seconds_Behind_Master | awk '{print $2}') if (( 5 > $lag )) then echo "Slave lag=$lag seconds,It's OK | lag=${lag}Seconds;0" exit 0 else echo "Slave lag=$lag seconds,It's Critcl | lag=${lag}Seconds;0" exit 2 fi
自己做笔记,MARK下