Skip to content

Latest commit

 

History

History
executable file
·
86 lines (55 loc) · 5.16 KB

README.md

File metadata and controls

executable file
·
86 lines (55 loc) · 5.16 KB

speedtest-cron

GitHub stars GitHub forks GitHub issues Inspired by J0s3f Twitter Twitter Follow

An easy to use script test the speed (down-, upload and ping) of your ISP regularly (cronjob). Inspired (Forked) by J0s3f's speedtest_cron on gitgud.io.

Idea

To run speedtests we use speedtest-cli by Matt Martz. For consistent results, always use the same test server. Regular tests can be used to identify trends.

The tests should be performed as close to the modem / router as possible. In any case I recommend you use a Ethernet (network) cable.

Ideal would be the execution directly on your router. If it has a storage for storing the measurement data and has enough power to run Python, you should run the code on the router. Otherwise I recommend to use a RaspberryPi or similar, which is connected by cable to the router.

System Requirements

A UNIX-like system with Python (at least 2.5) is required to run the scripts.

Submodule

If the folder speedtest_cli is empty run git submodule update --init. It should then checkout the commit with the hash 33e498beb30149ffe233b835cf1fcf012462d219.

Troubleshooting

If the initialization fails (eg. because of the "Permission denied (publickey)." error), you have to follow the proposed solution here #1. Thank you kyletaylored for reporting the issue.

Installation

speedtest_cron

With ./speedtest_cron you run the test. But before you run the script you should change the speedtest server.

The current server is 5351 (UPC (Vienna, Austria)). You can get a list of available servers by running ./speedtest_cli/speedtest_cli.py --list. Replace the serverId with the one you would like to use. In order to find the best one, I suggest you run a speedtest on speedtest.net first and use the server they use.

With `/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` we get your current IP-Address and use it as the source for the speedtest. If you run into problems you can remove --source `/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` though.

speedtest_crontab

speedtest_cron should run regularly to be able to analyse trends. To do so you should add a cronjob to /etc/crontab or crontab -e. Take a look at the speedtest_crontab file and replace /path/to/this/folder/ with the actual path.

speedtest_csv

With ./speedcsv > results.csv you generate a file of the generated results (one file per test in the speedtests folder). You can then further evaluate the results in a spreadsheet.

speedtest_ifttt

After reading the "Use Raspberry Pi to Measure Broadband Speeds to Hold Your ISP Accountable" article I decided to implemented Aallan's work here too. Because I would like to get either a push notification when the internet speed drops or add the result to a Google Spreadsheet automatically. This is how you use it:

  • rename example.cfg to speedtest.cfg
  • setup the maker channel on IFTTT
  • add an Applet like this one
  • add the secret key and event name to the speedtest.cfg
  • run the script ./speedtest_ifttt

Development

Improvements, suggestions or bug fixes are very welcome. Just create a pull request.

If you have updated the submodule (eg. different release/commit), update it with:

git submodule foreach --recursive 'git reset --hard'

Similar projects

There are other projects available, like speedtest-cli-extras by HenrikBengtsson, speedtest-cron by vwillcox or speedtest-cron by brainTrain. The last one makes use of Google Spreadsheets and IFTTT's Maker.