Coder Social home page Coder Social logo

tassan / my-internet-speed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cuducos/my-internet-speed

0.0 2.0 0.0 82 KB

🛎️ Monitor the speed your ISP is delivering

License: GNU General Public License v3.0

Dockerfile 4.42% HTML 3.04% Elm 47.00% JavaScript 14.40% CSS 0.55% Python 30.59%

my-internet-speed's Introduction

Tests Coverage Maintainability

My Internet Speed

I wrote this app so I can periodically monitor my internet speed and:

  • Collect data to build a report about the quality of the service provided by my ISP
  • Automatically tweet my ISP when the speed is lower than expected – surely optional
  • Store speed test results in PostgreSQL
  • Check all speed test results in a web API
  • Monitor all speed test tasks

At home this runs on my Raspberry Pi.

Installing

Requirements

It is important to run this app in a computer connected to the internet via ethernet cable, not via wireless – this is the way to have a good accuracy in testing the speed.

Optionally, if you want the Twitter feature to work (it will only tweet when the speed is below the configures threshold):

  • Twitter consumer key and secret
  • Twitter access token and access token secret

You can get these Twitter credentials at the Twitter Application Management dashboard.

Settings

Before you get started, copy .env.sample as .env and edit as follows:

  1. Set INTERVAL according to how often (in minutes) you want to run the speed test (e.g.: 20 for 20min)
  2. Set your TIMEZONE accordingly

If you want the app to post tweets:

  1. Add your Twitter credentials at the top of the file
  2. Set CONTRACT_SPEED to the speed in Mbps you are paying for (e.g.: 60 if you contract says 60Mbps)
  3. Set THRESHOLD to the minimum percentage of the contract speed you contract or local laws enforces your ISP (e.g.: 0.4 for 40%)
  4. Set your tweet message using {contract_speed} where the contract speed in Mbps should be (for example, 60 for 60Mbps), {real_speed} where the measured speed should be, and {percentage} where comparing both should be (feel free to use the Twitter handle of your ISP too)
  5. Add {result_url} in order to add the link to the result provided by SpeedTest

For example, if:

  • the measured speed is 20Mpbs
  • your CONTRACT_SPEED is 60
  • the THRESHOLD is 0.4
  • and TWEET is configures as I pay for {contract_speed}, but now @MyISP is working at {real_speed} – merely {percentage} of what I'm paying for :( {result_url}

The final tweet would be:

I pay for 60Mbps, but now @MyISP is working at 20Mbps – merely 33% of what I'm paing for :( http://www.speedtest.net/result/7307126311

If you like this app, add #MyInternetSpeed https://github.com/cuducos/my-internet-speed to your tweets ; )

Database

This docker-compose.yml lefts out the db container from all possible depends_on in order to make it easier to use an external/remote database to persist data (just point POSTGRESs variables and the PGRST ones to somewhere else).

Thus if you are using the Docker database it is useful to start it manually first:

$ docker-compose up -d db

In both cases run this one off command to create the database tables:

$ docker-compose run --rm beat python \
  -c "from my_internet_speed.models import Result; Result.create_table()"

Spinning up the app

$ docker-compose up -d

Services

This spins up different services that might be useful to check the status of the speed tests:

Troubleshooting

UnixHTTPConnectionPool(host='localhost', port=None): Read timed out.

I was getting this error in my Raspberry Pi when trying to run docker-compose up. This seams to be a workaround:

$ export DOCKER_CLIENT_TIMEOUT=600
$ export COMPOSE_HTTP_TIMEOUT=600

Testing

$ docker-compose run --rm beat py.test

Also we use Black code formatter:

$ docker-compose run --rm beat black . --check

my-internet-speed's People

Contributors

cuducos avatar lipemorais avatar nicolastarzia avatar vmesel avatar

Watchers

James Cloos avatar Flávio Tassan avatar

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.