#!/bin/bash
MYSQLUSER=root
MYSQLPS=000000
MYSQLBIN=/usr/local/webserver/mysql/bin/mysqladmin
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_NUM=$($MYSQLBIN -u$MYSQLUSER -p$MYSQLPS version | grep "Server version" | grep "5.5.2-m2-log"|wc -l)
if [ $? -ne 0 ];then
echo "Please Check the Plugins"
exit $STATE_UNKNOWN
fi
if [ "${STATE_NUM}" -eq 1 ];then
echo "Check OK,MySQL Replication is running"
echo {`$MYSQLBIN -u$MYSQLUSER -p$MYSQLPS version`}
exit $STATE_OK
else
echo "Check Critical,MySQL Replication is error"
exit $STATE_CRITICAL
fi