I have write a ping script to continuous check our BGP routers and DNS link during the stability test.
[root@DNS Lok]# cat pingmon.sh
#!/bin/bash
HOSTS="router1 router2 PC1 DNS1 DNS2 ISP1link ISP2link"
# you need to add above hostname into your hosts table if they cannot be resolved from your DNS
COUNT=4
while :
do
for myHost in $HOSTS
do
count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -eq 0 ]; then
# 100% failed
echo "Host : $myHost is down in all 4 PING sequences at $(date)" >> pinglost.log
else
echo " HOST is UP in all 4 PING sequences $myHost"
fi
done
done
After script start, your can check the output status by :
tail -f pinglog.log
沒有留言:
張貼留言