#!/bin/sh # # Check that a mysql-slave is running # # usage: check_mysql_slave host user password # # @author peter.romianowski@optivo.net # @version 1.0 19.12.2004 IO=`mysql -h$1 -u$2 -p$3 -B -e "SHOW SLAVE STATUS" | cut -f 10 | tr "\n" " "` if [ "$IO" != "Slave_IO_Running Yes " ] ; then echo "CRITICAL Slave IO-Thread is not running (response was: $IO)" exit 1 fi SQL=`mysql -h$1 -u$2 -p$3 -B -e "SHOW SLAVE STATUS" | cut -f 11 | tr "\n" " "` if [ "$SQL" != "Slave_SQL_Running Yes " ] ; then echo "CRITICAL Slave SQL-Thread is not running (response was: $SQL)" exit 2 fi echo "OK Slave IO- and SQL-Thread are running" exit 0