Skip to content

jrowe88/speedtest_exporter

Repository files navigation

Prometheus SpeedTest Exporter

Run internet speed test and export metrics to Prometheus.

Getting started

Run in Docker Container (Intended Use)

  1. Pull Docker container:
docker pull jrowe88/speedtest_exporter
  1. Run in a Docker container (detached). Optionally, specifiy environment parameters to configure ports, interval, and startup delay.
docker run -d -p 9497:9497 --name speedtest_exporter jrowe88/speedtest_exporter

Run Script Directly

  1. Download and install SpeedTest CLI client

  2. Install Python 3

  3. Copy *.py files to a directory

  4. Run script in background

nohup python3 ./speedtest.py &>/dev/null &
  1. Goto http://localhost:9497/metrics to view metrics

Examples

  1. Change default parameters

Note: SpeedTest downloads and uploads many MB of data over your connection. Do not set the interval (INTERVAL_SECONDS) to be very short unless that is your intention and you understand the consequences to your internet traffic. Default is 1800 seconds, or every 30 minutes. This examples changes port to 9191, delay to 5s and interval to 7200s.

docker run -d -p 9191:9191 --env PORT=9191 --env INTERVAL_SECONDS=7200 --env STARTUPDELAY_SECONDS=5 --name speedtest_exporter jrowe88/speedtest_exporter
  1. Setting up Prometheus Scraper Config

Add a section similar to the prometheus.yml configuration file (or add another target to an existing job)

...
    - job_name: speed
      scrape_interval: 240s
      metrics_path: /metrics
      static_configs:
      - targets:
        - 192.168.1.3:9497
...

Reload the Prometheus config:

curl -X POST http://192.168.1.3:9497/-/reload

Other resources

Grafana Dashboard: https://grafana.com/dashboards/12309

Prometheus configuration: https://prometheus.io/docs/prometheus/latest/configuration/configuration/


Copyright @ 2020 Jim Rowe

About

Prometheus exporter for running periodic internet speed tests using the SpeedTest CLI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published