Skip to content

Instantly share code, notes, and snippets.

@e23z
Created July 25, 2017 15:02
Show Gist options
  • Save e23z/a36c8e81486153bb4c4de00b1e02bee1 to your computer and use it in GitHub Desktop.
Save e23z/a36c8e81486153bb4c4de00b1e02bee1 to your computer and use it in GitHub Desktop.
[Linode Speedtest] Script to test Linode response & download speed. #scripts #test #utils #linode
#!/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]
}
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment