Simple daemon for tracking network speed with ookla speedtest and exporting the metrics to prometheus
Go to file
2024-10-21 22:56:04 +02:00
.gitignore First version 2024-10-19 15:43:07 +02:00
dashboard-example.png Add grafana example 2024-10-21 22:55:48 +02:00
go.mod First version 2024-10-19 15:43:07 +02:00
go.sum First version 2024-10-19 15:43:07 +02:00
grafana_dashboard.json Add grafana example 2024-10-21 22:55:48 +02:00
main.go gofmt 2024-10-21 22:56:04 +02:00
README.md Add grafana example 2024-10-21 22:55:48 +02:00

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

Example Grafana Dashboard

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