GithubHelp home page GithubHelp logo

kiwinetwork / speedtest-for-influxdb-and-grafana Goto Github PK

View Code? Open in Web Editor NEW

This project forked from barrycarey/speedtest-for-influxdb-and-grafana

0.0 3.0 0.0 17 KB

A tool to run periodic speedtests and save them in InfluxDB for graphing in Grafana

Dockerfile 9.85% Python 84.18% Shell 5.96%

speedtest-for-influxdb-and-grafana's Introduction

Speedtest to InfluxDBv2


This is a Python script that will continuously run the official Speedtest CLI application by Ookla, takes input from environment variables, formats data and writes it to an InfluxDB v2 database.

This script will allow you to measure your internet connections speed and consistency over time. It uses env variables as configuration. It's as easy to use as telling your Docker server a 1 line command and you'll be set. Using Grafana you can start exploring this data easily.

Breadlysm built a grafana dashboard for this data that can be found at https://grafana.com/grafana/dashboards/13053. Additionally, an extended version of that dash by other contributors can be found here. Use GrafanaDash-SpeedTests.json to import that dash into Grafana, though you will have to adapt it a lot to work with the newer InfluxDB version.

OriginalDash Variant

There are some added features to allow some additional details that Ookla provides as tags on your data. Some examples are your current ISP, the interface being used, the server who hosted the test. Over time, you could identify if some servers are performing better than others.

Configuring the script

The InfluxDB connection settings are controlled by environment variables.

The variables available are:

  • NAMESPACE = default - None
  • INFLUX_DB_ADDRESS = default - influxdb:8086
  • INFLUX_DB_TOKEN = no default, required for any operation
  • INFLUX_DB_ORG = default - speed-org
  • INFLUX_DB_BUCKET = default - speedtests
  • INFLUX_DB_VERIFY_SSL = default - True
  • INFLUX_DB_TAGS = default - None * See below for options, '*' widcard for all *
  • SPEEDTEST_INTERVAL = default - 5 (minutes)
  • SPEEDTEST_SERVER_ID = default - {blank} * id from https://c.speedtest.net/speedtest-servers-static.php *
  • PING_INTERVAL = default - 5 (seconds)
  • PING_TARGETS = default - 1.1.1.1, 8.8.8.8 (csv of hosts to ping)
  • SPEEDTEST_DEBUG = default - False

Variable Notes

  • Intervals are in minutes. Script will convert it to seconds.
  • If any variables are not needed, don't declare them. Functions will operate with or without most variables.
  • Tags should be input without quotes. INFLUX_DB_TAGS = isp, interface, external_ip, server_name, speedtest_url
  • NAMESPACE is used to collect data from multiple instances of the container into one database and select which you wish to view in Grafana. i.e. Breadlysm has one monitoring their Starlink, the other their TELUS connection.

Tag Options

The Ookla speedtest app provides a nice set of data beyond the upload and download speed. The list is below.

Tag Name Description
isp Your connections ISP
interface Your devices connection interface
internal_ip Your container or devices IP address
interface_mac Mac address of your devices interface
vpn_enabled Determines if VPN is enabled or not? I wasn't sure what this represented
external_ip Your devices external IP address
server_id The Speedtest ID of the server that was used for testing
server_name Name of the Speedtest server used for testing
server_country Country where the Speedtest server resides
server_location Location where the Speedtest server resides
server_host Hostname of the Speedtest server
server_port Port used by the Speedtest server
server_ip Speedtest server's IP address
speedtest_id ID of the speedtest results. Can be used on their site to see results
speedtest_url Link to the testing results. It provides your results as it would if you tested on their site.

Additional Notes

Be aware that this script will automatically accept the license and GDPR statement so that it can run non-interactively. Make sure you agree with them before running.

Get Docker image.

  1. Latest version
  2. Run the container.
 docker run -d -t --name speedflux \
-e 'NAMESPACE'='None' \
-e 'INFLUX_DB_ADDRESS'='influxdb:8086' \
-e 'INFLUX_DB_ORG'='my-awesome-org' \
-e 'INFLUX_DB_TOKEN'='1NCR3D1BLY-L0NG-T0K3N-ST71NG' \
-e 'INFLUX_DB_BUCKET'='speedtests' \
-e 'SPEEDTEST_INTERVAL'='5' \
-e 'SPEEDTEST_FAIL_INTERVAL'='5'  \
-e 'SPEEDTEST_SERVER_ID'='12746' \
redkill2108/speedtest-for-influxdb-and-grafana:latest

speedtest-for-influxdb-and-grafana's People

Contributors

atribe avatar ax42 avatar barrycarey avatar jdebetaz avatar

Watchers

 avatar  avatar  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.