Skip to content

r3htanz/speedtest_exporter

 
 

Repository files navigation

Project Forked from [aaronmwelborn/speedtest_exporter|(https://github.com/aaronmwelborn/speedtest_exporter)]

logo

Speedtest Prometheus Exporter


This is a modified version of the original Speedtest exporter, tailored for setups like the Synology DS220+. The original exporter did not work reliably in my environment, as speed tests often take more than one minute to complete. However, the original version times out after one minute and cancels the test. This version increases the timeout to two minutes, which works well for my setup.

build goreleaser Code Scanning - Action License Release GHCR Docker Pulls GitHub go.mod Go version Go Report Card os/arch os/arch os/arch

Usage:

Flags

speedtest_exporter is configured by optional command line flags

$ ./speedtest_exporter --help
Usage of speedtest_exporter
  -port string
        listening port to expose metrics on (default "9877")
  -server_fallback
        If the serverID given is not available, should we fallback to closest available server
  -server_id int
        Speedtest.net server ID to run test against, -1 will pick the closest server to your location (default -1)

Binaries

For pre-built binaries please take a look at the releases.

./speedtest_exporter [flags]

Docker

Docker Image can be found at GitHub Container Registry & Dockerhub .

Example:

docker pull ghcr.io/r3htanz/speedtest_exporter:latest

docker run \
  -p 9877:9877 \
  ghcr.io/r3htanz/speedtest_exporter:latest [flags]

Setup Prometheus to scrape speedtest_exporter

Configure Prometheus to scrape metrics from localhost:9877/metrics

This exporter locks (one concurrent scrape at a time) as it conducts the speedtest when scraped, remember set scrape interval, and scrap timeout accordingly as per example.

...
scrape_configs
    - job_name: speedtest
      scrape_interval: 60m
      scrape_timeout:  120s
      static_configs:
        - targets: ['localhost:9877']
...

Exported Metrics:

# HELP speedtest_download_speed_Bps Last download speedtest result
# TYPE speedtest_download_speed_Bps gauge
# HELP speedtest_latency_seconds Measured latency on last speed test
# TYPE speedtest_latency_seconds gauge
# HELP speedtest_scrape_duration_seconds Time to preform last speed test
# TYPE speedtest_scrape_duration_seconds gauge
# HELP speedtest_up Was the last speedtest successful.
# TYPE speedtest_up gauge
# HELP speedtest_upload_speed_Bps Last upload speedtest result
# TYPE speedtest_upload_speed_Bps gauge

Example Grafana Dashboard:

https://grafana.com/grafana/dashboards/14336

About

Prometheus exporter that runs speedtest and exposes results

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Go 91.3%
  • Dockerfile 8.7%