Test data center network connectivity and latency (shell script)

Source: Internet
Author: User

Test data center network connectivity and latency (shell script) Failover (mobile) Script 1 :#! /Bin/bash ping-c 100 $1> test/temp _ $1 tail-n 3 test/temp _ $1 traceroute $1 script 2: the task is scheduled to be executed every 15 minutes :#! /Bin/bash DateTime = 'date "+ % Y % m % d % H % M" 'date = 'date "+ % Y % m % d" 'CD ~ Mkdir-p test/temp mkdir-p test/$ {Date}/wt mkdir-p test/$ {Date}/dx mkdir-p test/$ {Date}/edu mkdir -p test/$ {Date}/cmcc while true; do read iplist | break; sh ping_tr.sh $ iplist> test/$ {Date}/wt/javasiplist?#datetime=.txt & done <ip.txt while true; do read iplist | break; sh ping_tr.sh $ iplist> test/$ {Date}/edu/$iplist?#datetime=.txt & done <ipedu.txt www.2cto.com while true; do read iplis T | break; sh ping_tr.sh $ iplist> test/$ {Date}/dx/$iplist?#datetime=.txt & done <ipdx.txt while true; do read iplist | exit; sh ping_tr.sh $ iplist> test/$ {Date}/cmcc/$iplist?#datetime=.txt & done <ipcmcc.txt II. Generate a data report and send an email to cront configuration of the system O & M department: 20, 50 7-23 ***/bin/bash/root/net-monitor.sh #! /Bin/bash #2011/08/04 time = 'date + % Y % m % d' time1 = 'date + % Y % m % d % H % M-d "20 minutes ago" 'time2 = 'date + % H: % M-d "20 minutes ago" '[-d/home/larry/vnet/$ {time}] | mkdir/home/larry/vnet/$ {time} path = '/root/test' isp = (dx wt edu cmcc) wt = '/root/ip.txt' dx = '/root/ipdx.txt' cmcc = '/root/ipcmcc.txt' edu = '/root/ipedu.txt' com () {awk 'in in {print "-------------------------------------"} 'awk' BEGIN {printf "| %-3s | %-16 s | %-8 s | \ n", "ISP ", "IP ", "'$ time2'"} 'awk' BEGIN {print "-----------------------------------------"}' for x in $ {isp [@]} www.2cto.com do for I in 'eval cat \ $ x' do grep-E \ (--- \ | ^ rtt \) $ {path}/$ {time}/$ x/${ I }{{time1}.txt | awk 'in in {FS = "/|"} NR % 2 = 1 {a = $2} NR % 2 = 0 {printf "| %-3s | %-16 s | %-8 s | \ n ", "'$ x'",, $8} 'done awk' BEGIN {print "success"} 'done} com>/home/larry/vnet/$ {time}/${time1}.txt myip = 'ifconfig eth0 | grep' inet addr '| awk' {print $2} '| awk-F ': ''{print $2} ''echo "############################# ######################################## #### ">/home/larry/vnet/$ {time}/${time1.txt echo" Packet Loss ">>>/home/larry/vnet/$ {time}/${time1}.txt echo "$ time2 o 'clock">/home/larry/vnet/$ {time}/${time1).txt grep 'packet loss'/root/test/$ {time }/*/ * required bytes time10000.txt | grep-v '1970 packet loss' | awk-F ', ''{print $1 $2 $3} '| awk-F'/'' {print $5 usd/" $6}'>/home/larry/vnet/$ {time}/${time1}.txt cat/home/larry/vnet/$ {time}/${time1}.txt mail-s "$ {time1 }_$ myip network monitor" sys@ilarry.com ---f cnc.2@ilarry.com

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.