Skip to content

Instantly share code, notes, and snippets.

@void285
Forked from cyfdecyf/linode-speedtest.sh
Last active May 29, 2019 13:28
Show Gist options
  • Save void285/4be93dcf80b7182f076564f3842d02b4 to your computer and use it in GitHub Desktop.
Save void285/4be93dcf80b7182f076564f3842d02b4 to your computer and use it in GitHub Desktop.
Linode speedtest with 9 facilities (Linode open new datacenter in Toronto in 2019-04)
#!/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.toronto1.linode.com/100MB-toronto.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
#!/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