The easiest way to get the data from our Raspberry Pi to IFTTT at this point is to modify the speedtest-cli-extras script. This is where IFTTT‘s Maker Channel, introduced towards the middle of last year, comes in handy. I went ahead and created a recipe on IFTTT to take the data passed to Maker Channel event called “speedtest” and automatically fill a Google Sheet with the output of speedtest-cli script. Running this every hour from cron is going to start to pile up evidence in a nicely formatted data file, hopefully allowing us to have a satisfying argument with our broadband provider inside a few days.Įxcept that, while I’m on the road, I don’t want to have to SSH into the Raspberry Pi connected to my ADSL modem, grab the CSV file, and manually post it the trouble ticket I’ve filed with my broadband provider. 17:00:33 17:01:27 Acme Broadband Provider Foo Limited (Metropolis) 2.52 km 34.768 ms 14.43 Mbit/s 1.31 Mbit/s Īgain with names changed to protect the guilty. As you can see the output is much more useful, especially if we want to create graphs, than we had previously. It captures the output of the script, reformats it, and outputs it on a single line with time stamps and values separated by semicolons, $ git clone Which is exactly what the speedtest-cli-extras script does. But since this is a quick hack, it’s probably easiest just to fix things with a bash script. We could go into the package and fix things so that the output is somewhat more useful, CSV format perhaps, or we could rewrite the whole thing in Perl. However the output of the speedtest-cli package, even in its “simple” mode, is pretty messy. This will run the test once an hour, at the top of the hour, appending the dates-stamped output of the speedtest command to a log file. You can do that by typing, $ crontab -eĪt the command line, and then adding the line, 0 * * * * /home/pi/speedtest-cron.sh Then go ahead and edit your crontab file, adding an entry to run the script test once an hour. usr/local/bin/speedtest -simple > /home/pi/speedtest.log The easiest way to do this is to create a quick script, lets call it speedtest-cron.sh which will log the date and the output of the test to a file, #!/bin/bash In any case, now we have out command line tool installed we can run it automatically using cron - which allows you to schedule commands to run at specified times - every hour, and log the output to a file. Which makes me rather jealous of our friend in Washington, who is complaining to Comcast when his 150Mbit/s connection drops to a low of 50Mbit/s. Because, every so often, I go through patches where my latency rises to several hundred milliseconds, and my bandwidth drops to 1 or 2 Mbit/s. However I’ve more or less given up on obtaining that, these days I’m just happy if it’s stable. While this is my average speed, it’s well below what I’m paying for, which is 25 Mbit/s down and 2.5 Mbit/s up. I have an ADSL2+ Annex M connection, unfortunately FTTC hasn’t quite made it to my parts of the world. Testing upload speed.Īlthough I’ve disguised other details, that really is my average reported broadband speed. Hosted by Foo Limited (Metropolis) : 35.27 ms Once installed it’s rather easy to grab measure your broadband speed. This will install pip - a package management system for python - if you don’t already have it installed, and then the speedtest-cli package from the pip repositories. Just open up a terminal window on your Raspberry Pi and type the following at the command line, $ sudo apt-get install python-pip Most recently I’ve switched to using speedtest-cli, a command line interface to the servers written in Python. Over the time I’ve been doing this I’ve used various methods to measure the latency and speed of my broadband connection. Instead my script is a bit more direct, it automatically submits a trouble ticket into their support queue. Well, not the bit where I tweet my broadband provider. This is actually something I’ve been doing myself for a couple of years, also using a Raspberry Pi stuffed in corner of my network closet.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |