Created
August 4, 2015 07:53
-
-
Save cyfdecyf/f142a03ecd7465c13e88 to your computer and use it in GitHub Desktop.
Linode speedtest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
list=" | |
http://speedtest.newark.linode.com/100MB-newark.bin | |
http://speedtest.atlanta.linode.com/100MB-atlanta.bin | |
http://speedtest.dallas.linode.com/100MB-dallas.bin | |
http://speedtest.fremont.linode.com/100MB-fremont.bin | |
http://speedtest.frankfurt.linode.com/100MB-frankfurt.bin | |
http://speedtest.london.linode.com/100MB-london.bin | |
http://speedtest.singapore.linode.com/100MB-singapore.bin | |
http://speedtest.tokyo.linode.com/100MB-tokyo.bin | |
" | |
test_download_speed() { | |
for i in $list; do | |
echo $i | |
curl "$i" >/dev/null & | |
sleep 10 | |
echo | |
kill $! | |
wait | |
echo | |
done | |
} | |
test_ping() { | |
for i in $list; do | |
host=$(echo $i | awk -F '/' '{ print $3 }') | |
ping -q -c 30 $host | |
echo | |
done | |
} | |
#test_download_speed | |
test_ping | tee log-ping.txt | |
awk -f ./report-ping.awk ./log-ping.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/awk -f | |
BEGIN { | |
printf "host\tloss\trtt min\tavg\tmax\tstddev\n" | |
} | |
/^---/ { | |
split($2, a, ".") | |
printf "%s\t", a[2] | |
} | |
/^[0-9]+ packets transmitted/ { | |
printf "%s\t", $7 | |
} | |
/^round-trip/ { | |
split($4, a, "/") | |
printf "%s\t%s\t%s\t%s\n", a[1], a[2], a[3], a[4] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment