Sunday, January 17, 2016

downtime measurement with linux ping script in bash

During a equipament upgrade in the datacenter, sometimes we need to measure downtime, mainly when and how long it was down.
One way is to do it with a list of pings:

while :; do
  for ip in $(cat /my/script/dir/listofipstoping.txt)
  do
     ping -c 1 -W 1 $ip >/dev/null || echo "PING TO $ip FAILED @ `date`";
  done
done

No comments: