监控redis端口如下:
#!/bin/sh
#Created by hys 20140823
declare -a master_is
master_is=($(redis-cli -h 192.168.0.76 -p 7711 INFO |grep role |awk -F: ‘{print $2}‘))
echo $master_is
if [ ${master_is} == "master" ];then
echo "OK -slave is running"
exit 0
else
echo "Critical -slave is error"
exit 2
fi
监控url地址如下:
#!/bin/sh
#Created by hys 20140823
ttl=`curl -o /dev/null -s -L --connect-timeout 60 http://192.168.0.161:8080 -w %{http_code}`
if [ "$ttl" == 200 ];
then
echo "OK url is running"
exit 0
else
echo "Critical url is error"
exit 2
fi
时间: 2024-10-06 16:08:34