1、利用curl 监控业务的存活性
#!/bin/bash
RET=$(curl -s )
STATUS=$(echo $RET|grep 0)
if test -z "$STATUS"
then
echo "CRITICAL status -$RET "
exit 2 #Return OK status
else
echo "OK status - $RET"
exit 0 #Return OK status
fi
2、有时候的有的端口不允许127.0.0.1连接,可以用它的真实ip
#!/bin/bash
RET=$(/usr/local/nagios/libexec/check_tcp -H10.186.120.23 -p5000)
STATUS=$(echo $RET|grep 'refused')
if test -z "$STATUS"
then
echo "OK status - OK"
exit 0 #Return OK status
else
echo "CRITICAL status -refused "
exit 2 #Return OK status
fi
阅读(1257) | 评论(0) | 转发(0) |