Speedtest Metrics Exporter is a Prometheus exporter designed to collect and expose network performance metrics using speedtest.net servers. Its unique feature is the ability to test multiple servers in a single iteration, providing comprehensive network performance data across different geographical locations and service providers.
- Multi-Server Testing: Test multiple speedtest servers in a single iteration by specifying server IDs, enabling comprehensive network performance monitoring across different locations
- Automatic Server Selection: If no server IDs are specified, the exporter automatically selects the closest server for testing
- Comprehensive Metrics: Collects detailed metrics including download speed, upload speed, latency, jitter, and test duration
- Server Information: Provides rich server metadata including server name, sponsor/provider, and distance
- Configurable Update Intervals: Customize how frequently speed tests are performed
- Optional BasicAuth Protection: Secure your metrics endpoint with basic authentication
- Instance Labeling: Support for instance labels to distinguish between multiple exporter instances
- Memory Optimization: Implements garbage collection after each test to maintain optimal performance
The exporter provides the following metrics:
Name | Description |
---|---|
speedtest_download_bits_per_second |
Download speed in bits per second |
speedtest_upload_bits_per_second |
Upload speed in bits per second |
speedtest_latency |
Latency in milliseconds |
speedtest_jitter |
Jitter in milliseconds |
speedtest_test_duration |
Test duration in seconds |
Each metric includes the following labels:
server_id
: Speedtest server identifierserver_name
: Name of the speedtest serverserver_sponsor
: Server sponsor/providerserver_distance
: Distance to server in kilometersinstance
: Custom instance label (optional)
The exporter can be configured using environment variables or command-line arguments:
Environment Variable | Command-Line Argument | Required | Default | Description |
---|---|---|---|---|
METRICS_PORT |
--metrics-port |
No | 9090 |
Port to expose metrics on |
METRICS_PROTECTED |
--metrics-protected |
No | false |
Enable BasicAuth protection |
METRICS_USERNAME |
--metrics-username |
No | metricsUser |
Username for BasicAuth |
METRICS_PASSWORD |
--metrics-password |
No | MetricsVeryHardPassword |
Password for BasicAuth |
UPDATE_INTERVAL |
--update-interval |
No | 60 |
Test interval in minutes |
SERVER_IDS |
--server-ids |
No | 0 |
Comma-separated list of speedtest server IDs. If not specified or set to 0, the closest server will be selected automatically |
INSTANCE |
--instance |
No | "" |
Instance label for metrics |
See how to find Speedtest.net server IDs for instructions on locating specific server IDs.
# With specific server IDs
speedtest-exporter --server-ids=1234,5678 --update-interval=60 --metrics-port=9090
# With basic auth protection
speedtest-exporter --metrics-protected --metrics-username=custom_user --metrics-password=custom_pass
# With default server selection (closest server will be chosen automatically)
speedtest-exporter
docker run -d \
-e SERVER_IDS=1234,5678,9012 \
-e UPDATE_INTERVAL=60 \
-p 9090:9090 \
kutovoys/speedtest-exporter
services:
speedtest-exporter:
image: kutovoys/speedtest-exporter
environment:
- SERVER_IDS=1234,5678,9012
- UPDATE_INTERVAL=60
- METRICS_PROTECTED=true
- METRICS_USERNAME=custom_user
- METRICS_PASSWORD=custom_password
ports:
- "9090:9090"
Add the following to your prometheus.yml:
scrape_configs:
- job_name: "speedtest"
static_configs:
- targets: ["localhost:9090"]
scrape_interval: 60m
To test multiple servers, specify their IDs in the SERVER_IDS environment variable or --server-ids argument:
docker run -d \
-e SERVER_IDS=1234,5678,9012 \
-p 9090:9090 \
kutovoys/speedtest-exporter
This will:
- Test server ID 1234 first
- After completion, test server ID 5678
- Finally, test server ID 9012
- Wait for the configured update interval before starting the next iteration
The exporter maintains separate metrics for each server, allowing you to:
- Compare performance across different providers
- Monitor network quality to different geographical locations
- Identify regional network issues
- Track performance trends per server
/metrics
- Prometheus metrics endpoint/health
- Health check endpoint/
- Basic information page
Contributions to Speedtest Metrics Exporter are warmly welcomed. Whether it's bug fixes, new features, or documentation improvements, your input helps make this project better. Here's a quick guide to contributing:
- Fork & Branch: Fork this repository and create a branch for your work.
- Implement Changes: Work on your feature or fix, keeping code clean and well-documented.
- Test: Ensure your changes maintain or improve current functionality, adding tests for new features.
- Commit & PR: Commit your changes with clear messages, then open a pull request detailing your work.
- Feedback: Be prepared to engage with feedback and further refine your contribution.
Happy contributing! If you're new to this, GitHub's guide on Creating a pull request is an excellent resource.