Monitoring my broadband connection
My home internet connection quality seems to yoyo from day to day. Our area is yet to receive so-called “superfast” broadband and I’m stuck with somewhere between 0.5-2Mbit/s depending on contention. Frustrating.
I wanted to keep an eye on the speed I was paying for so hacked together the following system to help me track the connection speed each hour. If you want to do the same, here’s what you need to do.
$ easy_install speedtest-cli
Next create a file called
speedtest.rb in your
system('speedtest-cli --simple > /tmp/speedtest.out') result = File.read('/tmp/speedtest.out') matches = result.match(/Download: ([0-9\.]*)/) speed = matches puts Time.now.strftime('%Y-%m-%d %H:%M,') + speed
This script outputs the current time and speed ready for you to append to a file. You’ll want to run this every hour via cron so add this to your user’s crontab:
$ crontab -e 0 * * * * ruby ~/bin/speedtest.rb >> ~/Documents/speedtest.csv