https://github.com/natterstefan/speedtest-cron
An easy to use script test the speed (down-, upload and ping) of your ISP regularly (cronjob).
https://github.com/natterstefan/speedtest-cron
alexa-skill cron cron-jobs crontab ifttt python raspberry-pi speedtest
Last synced: 6 months ago
JSON representation
An easy to use script test the speed (down-, upload and ping) of your ISP regularly (cronjob).
- Host: GitHub
- URL: https://github.com/natterstefan/speedtest-cron
- Owner: natterstefan
- License: wtfpl
- Created: 2017-02-11T10:23:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-11T10:45:48.000Z (over 6 years ago)
- Last Synced: 2025-03-24T02:51:36.291Z (6 months ago)
- Topics: alexa-skill, cron, cron-jobs, crontab, ifttt, python, raspberry-pi, speedtest
- Language: Shell
- Homepage:
- Size: 12.7 KB
- Stars: 21
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# speedtest-cron
[](https://github.com/natterstefan/speedtest-cron/stargazers)
[](https://github.com/natterstefan/speedtest-cron/network)
[](https://github.com/natterstefan/speedtest-cron/issues)
[](https://gitgud.io/J0s3f/speedtest_cron)
[](https://twitter.com/intent/tweet?text=https://github.com/natterstefan/speedtest-cron)
[](https://twitter.com/natterstefan)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][jsspcr].
## Idea
To run speedtests we use [speedtest-cli by Matt Martz][spcli]. 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](https://github.com/natterstefan/speedtest-cron/issues/1#issuecomment-440756964).
Thank you [kyletaylored](https://github.com/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](speedtest) 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][iftttmaker]" article I decided to implemented [Aallan's work][gistaallan] 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][maker]
- add an Applet [like this one][ifapplet]
- 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:
```bash
git submodule foreach --recursive 'git reset --hard'
```## Similar projects
There are other projects available, like [speedtest-cli-extras by HenrikBengtsson][spclix], [speedtest-cron by vwillcox][vwillcox] or [speedtest-cron by brainTrain][brainTrain]. The last one makes use of [Google Spreadsheets and IFTTT's Maker][iftttmaker].
[spcli]: https://github.com/sivel/speedtest-cli
[spclix]: https://github.com/HenrikBengtsson/speedtest-cli-extras
[vwillcox]: https://github.com/vwillcox/speedtest-cron
[brainTrain]: https://github.com/brainTrain/speedtest-cron
[speedtest]: http://www.speedtest.net/
[jsspcr]: https://gitgud.io/J0s3f/speedtest_cron
[iftttmaker]: http://makezine.com/projects/send-ticket-isp-when-your-internet-drops/
[gistaallan]: https://gist.github.com/aallan/bafc70a347f3b9526d30
[ifapplet]: https://ifttt.com/applets/49618185d-log-speedtest-results-to-spreadsheet
[maker]: https://ifttt.com/maker