This is a speedtest container using speedtest-cli on alpine-python3.8.
Based on docker hub python. with python:3.8-alpine Dockerfile.
Originally this container's idea comes from robinmanuelthiel/speedtest. His main implementation is shell script and sometimes does not work so I create a new Python implementation.
| Variable | Description | Example |
|---|---|---|
| LOOP_DELAY | checking every n seconds | 60 |
| DB_HOST | InfluxDB host | http://influxdb:8086 |
| DB_NAME | InfluxDB DB name | speedtest |
| DB_USERNAME | InfluxDB user | admin |
| DB_PASSWORD | InfluxDB password | admin_passW0rd |
Default CMD is:
/usr/local/bin/python /speedtest.py
1.0 - for linux/amd64 1.0-arm - for linux/arm/v7 (Raspberry pi 3/4)
version: '3'
services:
# Tests the current internet connection speed
# once per hour and writes the results into an
# InfluxDB instance
speedtest:
# for AMD CPU
image: mcchae/speedtest:1.0
# for ARM CPU
#image: mcchae/speedtest:1.0-arm
restart: always
privileged: true # Needed for 'sleep' in the loop
depends_on:
- influxdb
environment:
- LOOP_DELAY=60
- DB_HOST=http://influxdb:8086
- DB_NAME=speedtest
- DB_USERNAME=admin
- DB_PASSWORD=admin_passW0rd
# Creates an InfluxDB instance to store the
# speed test results
influxdb:
image: influxdb:1.8
restart: always
volumes:
- influxdb:/var/lib/influxdb
ports:
- "8083:8083"
- "8086:8086"
environment:
- INFLUXDB_ADMIN_USER=admin
- INFLUXDB_ADMIN_PASSWORD=admin_passW0rd
- INFLUXDB_DB=speedtest
# Displays the results in a Grafana dashborad
grafana:
image: grafana/grafana:latest
restart: always
depends_on:
- influxdb
ports:
- 3000:3000
volumes:
- grafana:/var/lib/grafana
volumes:
grafana:
influxdb:To configure Grafana, you need to add InfluxDB as a data source and create a dashboard with the upload, download and ping values. You can find a example dashboard configuration in the speedtest-dashboard.json.