Monday, September 24, 2012

MySQL Replicaiton Slave Monitor Script

MySQL Replicaiton Slave Monitor Script


Slave_IO_Running=`mysql  -u root -pB0Mb@cu7$ -e "show slave status\G" | grep Slave_IO_Running | awk '{ print $2 }'`
Slave_SQL_Running=`mysql  -u root -pB0Mb@cu7$ -e "show slave status\G" | grep Slave_SQL_Running | awk '{ print $2 }'`

if [ $Slave_IO_Running == 'Yes' ] && [ $Slave_SQL_Running == 'Yes' ] ; then
        echo "Replication slave is running"
else
   echo "Replication slave is down"
fi

No comments:

Post a Comment