简单的ping监控Shell
时间:2009-08-20 来源:yangzhigang
简单的ping监控Shell
#!/bin/bash
# 本shell通过简单的ping结果和awk处理,进行ping的结果监控。如长期监控和复杂的延时数值数据--
# --绘图等,请用复杂的脚本或cacti等软件。
HOSTS="www.baidu.com"
COUNT=100
SUBJECT="Lost Packet,plesae note!"
EMAILID="[email protected]"
for DesHost in $HOSTS
do
count=$(ping -c $COUNT $DesHost | grep 'received' |awk -F ',' '{print $2}' |awk '{print $1}')
if [$connt lt 95];then
echo "Ping $DesHost is lost pacek >95% at $(date)" |mail -s "SUBJECT" $EMAILID
fi
done
相关阅读 更多 +