Considering that an internet connection is now deemed to be a human right you’d think that ISPs, that generally seem to rip us off anyway, would’ve managed to make their connections nice and reliable, especially when you take into account that the internet has been round for a good few years now and they’ve had plenty of time to get it right. Unfortunately this isn’t the case & I decided that I wanted a way to make sure that I wasn’t getting (too) ripped off by my ISP.
To this end I decided to make the use of the tools I already had available, a Speedtest to test the connection.
(The following is entirely Debian & Munin 2 biased, you may need to tweak it for your particular setup.)
The first job was to find some way to run Speedtest from the command line, fortunately while I was stumbling around the internet I came across speedtest-cli which makes life much easier. So first we need to get a copy of the script and put it somewhere:
(You’ll probably be needing to make sure you have a copy of Python installed too, for more info check out speedtest-cli’s GitHub page.)
Then we need to get some useful numbers from the script, we do this as a cron job because the script can take a while to run, use a lot of bandwidth & tends to timeout when run in Munin directly.
Create the file
/etc/cron.d/speedtest containing the following (modifying the speedtest-cli path to suit your needs of course):
Finally we need a Munin script to create the graphs, the script below should go in
/etc/munin/plugins/speedtest, don’t forget it make it executable too, or it might not run (
chmod +x /etc/munin/plugins/speedtest):
Finally, restart munin-node (probably something along the lines of
/etc/init.d/munin-node restart), give it an hour or so and enjoy your new statistics.
Check back soon.