#! /bin/sh
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
mysqlpath='/opt/mysql/mysql/bin'
crit="No"
null="NULL"
ok="Yes"
usage1="Usage: $0 -u user -p password -H Hostname"
exitstatus=$STATE_WARNING #default
while test -n "$1"; do
case "$1" in
-u)
user=$2
shift
;;
-p)
pass=$2
shift
;;
-h)
echo $usage1;
echo
exit $STATE_UNKNOWN
;;
-H)
host=$2
shift
;;
*)
echo "Unknown argument: $1"
echo $usage1;
echo
exit $STATE_UNKNOWN
;;
esac
shift
done
answer=`$mysqlpath/mysql -u $user -p$pass -e 'show slave status\G' | /bin/grep Slave_IO_Running | /bin/cut -f2 -d:`
# if null, critical
if [ $answer = $null ]; then
echo CRITICAL - $host - Slave IO Running is answering Null
exit $STATE_CRITICAL;
fi
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。