Python script to monitor your internet speed! ๐
Periodically run librespeed/speedtest-cli and send results to InfluxDB.
Note The assumption is made that you've already setup
InfluxDB 2.x.x
. Alternatively, you can use the Docker Compose method where this is setup for you.
List available server IDs:
docker run --rm -it ghcr.io/dbrennand/speeder:latest /librespeed --list
Next, start and configure speeder using the environment variables:
docker run -itd --rm --name speeder \
-e "SPEEDER_SPEEDTEST_INTERVAL=300" \
-e "SPEEDER_SPEEDTEST_SERVER_ID=49" \
-e "SPEEDER_INFLUXDB_HOST=influx.example.com" \
-e "SPEEDER_INFLUXDB_TOKEN=<Token>" \
-e "SPEEDER_INFLUXDB_ORG=speeder" \
-e "SPEEDER_INFLUXDB_BUCKET=speeder" \
ghcr.io/dbrennand/speeder:latest
The speeder script is configured using the below environment variables:
Name | Description | Default Value |
---|---|---|
SPEEDER_SPEEDTEST_INTERVAL |
Interval in seconds to run speedtests on. | 300 |
SPEEDER_SPEEDTEST_SERVER_ID |
Server ID to run speedtests against. Supports multiple IDs using a comma separated string. | "" |
SPEEDER_INFLUXDB_HOST |
InfluxDB hostname. | influxdb |
SPEEDER_INFLUXDB_PORT |
InfluxDB port. | 8086 |
SPEEDER_INFLUXDB_TOKEN |
InfluxDB token. | root |
SPEEDER_INFLUXDB_ORG |
InfluxDB organisation name. | speeder |
SPEEDER_INFLUXDB_BUCKET |
InfluxDB bucket name to write speedtest results to. | speeder |
The docker-compose.yml file in this repository will deploy speeder, InfluxDB 2.7.1
and Grafana containers. Grafana will be provisioned with InfluxDB as the data source and the pre-created dashboard:
-
Set the
SPEEDER_SPEEDTEST_SERVER_ID
environment variable located in the .env file to the server IDs to perform speedtests against.Note
If you don't know any server IDs, run the following command to list them:
docker run --rm -it ghcr.io/dbrennand/speeder:latest /librespeed --list
-
Set the
DOCKER_INFLUXDB_INIT_PASSWORD
,DOCKER_INFLUXDB_INIT_ADMIN_TOKEN
andGF_SECURITY_ADMIN_PASSWORD
environment variables located in the .env file. -
Start the compose stack:
docker compose up -d
Grafana will be accessible at http://localhost:3000
and your host's IP address.
I did NOT create the LibreSpeed project or CLI. The great folks over at LibreSpeed did.
If you like this project then please give their repositories a star! โญ
Daniel Brennand - Author
This project is licensed under the MIT License - see the LICENSE for details.