天天看點

監控鍊路路徑是否發生變化的腳本

test -n "$pop2" || pop2="www.softlayer.com www.google.com itunes.apple.com metrics.apple.com a4.mzstatic.c

om a2.mzstatic.com se.itunes.apple.com a3.mzstatic.com ax.init.itunes.apple.com a1.mzstatic.com su.itunes.

apple.com a1327.phobos.apple.com a978.phobos.apple.com dar.amazon-digital-ftp.com www.asana.com smalltreem

edia.basecamphq.com www.fb.com itunesconnect.apple.com store.steampowered.com cdn-117-121-249-254.sin.llnw

.net"

   time1=`date +%Y%m`

   time2=`date +%d`

   time3=`date -d '-1 day' +%d`

   if [ "$pop2"!="" ];then

           for name in ${pop2}; do

          curl -s  http://10.0.2.232/report/trace-website/${time1}/${time2}/${name}.txt |awk '{print $2}'|

sed '1,2d' >`date +%Y%m%d`${name}.txt

          curl -s http://10.0.2.232/report/trace-website/${time1}/${time3}/${name}.txt |awk '{print $2}'|s

ed '1,2d' >`date -d '-1 day' +%Y%m%d`${name}.txt

          diff `date -d '-1 day' +%Y%m%d`${name}.txt `date +%Y%m%d`${name}.txt >cn2-website`date +%Y%m%d`$

{name}change.txt

          if test -s cn2-website`date +%Y%m%d`${name}change.txt

  then

          echo " more cn2-website`date +%Y%m%d`${name}change.txt is change"|mail -s "cn2-website trace is

changing" [email protected]

  fi

          done

本文轉自 luoguo 51CTO部落格,原文連結:http://blog.51cto.com/luoguoling/1150264