简单的ping监控Shell
#!/bin/bash
# 本shell通过简单的ping结果和awk处理,进行ping的结果监控。如长期监控和复杂的延时数值数据--
# --绘图等,请用复杂的脚本或cacti等软件。
HOSTS=""
COUNT=100
SUBJECT="Lost Packet,plesae note!"
EMAILID=""
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
阅读(1476) | 评论(0) | 转发(0) |