Code Monkey home page Code Monkey logo

speedtest-cron's Introduction

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.

speedtest-cron's People

Contributors

natterstefan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

speedtest-cron's Issues

SSH version of Git submodule could error out

If you don't have an SSH key authenticated to your account, then you'll get a failure error.

pi@raspberrypi:~/speedtest-cron $ git submodule update --init
Submodule 'speedtest_cli' ([email protected]:sivel/speedtest-cli.git) registered for path 'speedtest_cli'
Cloning into '/home/pi/speedtest-cron/speedtest_cli'...
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is ---------------------------------.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:sivel/speedtest-cli.git' into submodule path '/home/pi/speedtest-cron/speedtest_cli' failed

Would suggest changing the git submodule path to HTTPS instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.