nagios监控redis端口、监控url接口告警脚本
监控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
本文出自 “我的运维博客” 博客,请务必保留此出处http://linuxpython.blog.51cto.com/10015972/1643793
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。