Simple daemon for tracking network speed with ookla speedtest and exporting the metrics to prometheus
.gitignore | ||
dashboard-example.png | ||
go.mod | ||
go.sum | ||
grafana_dashboard.json | ||
main.go | ||
README.md |
Speedporter
A simple daemon that executes the Ookla Speedtest CLI and exposes the metrics via a Prometheus Exporter.
Usage
The following environment variables can be used to configure the daemon:
Name | Default | Description |
---|---|---|
SPEEDTEST_METRICS_LISTEN_PORT |
9090 |
Which port to bind to for serving metrics |
SPEEDTEST_METRICS_LISTEN_ADDR |
0.0.0.0 |
Which address to bind to for serving metrics |
SPEEDTEST_PERIOD_MINS |
5 |
How often to run the test |
SPEEDTEST_EXEC |
/usr/bin/speedtest |
The Path to the Ookla Speedtest Executable |
Exported Prometheus Metrics
Name | Unit | Description |
---|---|---|
isp_download_speed |
Mb/s | Download Bandwidth |
isp_upload_speed |
Mb/s | Upload Bandwidth |
isp_ping_latency |
ms | Internet Connection Latency |
isp_packet_loss |
% | Percentage of Packets Lost During Test |
Example Visualization
This example Grafana dashboard is available to use in your instance here.
Dependencies
Install the Ookla Speedtest CLI
Build Dependencies
go
Build/Installation
git clone https://git.sdf.org/CRThaze/speedporter
cd speedporter
go build
- Copy
speedporter
executable to the desired installation location. Perhaps one of:/usr/local/bin
/opt/speedporter
~/.local/bin
SystemD Daemon
Here's an example Unit File you can use for SystemD
[Unit]
Description=Speedtest Metrics Reporter
After=network.target
[Service]
Type=simple
ExecStart=/opt/speedporter/speedporter
Restart=always
RestartSec=10
Environment="SPEEDTEST_METRICS_LISTEN_PORT=9091"
[Install]
WantedBy=default.target
- Create this unit file in
/etc/systemd/system/speedporter.service
- Then run:
systemctl enable speedporter
- And start it with:
systemctl start speedporter