Skip to main content

Automates major speed test sites with a web browser for continuous network quality monitoring

Project description

speedtest-z

PyPI version CI Python

日本語版 / Japanese

speedtest-z automates major speed test sites with a web browser, capturing real user-experience network quality for continuous monitoring.

  • Supports 8 speed test sites (Cloudflare, Netflix, Ookla, M-Lab, and more)
  • Zabbix integration for continuous network quality monitoring
  • Quick start: pip install speedtest-z

Demo - 8 speed test sites

Features

  • Runs speed tests on 8 different sites automatically (Cloudflare, Netflix/fast.com, Google Fiber, Ookla, Box-test, M-Lab, USEN, iNonius)
  • Sends results to Zabbix via trapper items (using zappix)
  • Optional Grafana Cloud integration via Prometheus Remote Write
  • Optional OpenTelemetry (OTLP) metrics export
  • Configurable test frequency per site (probability-based throttling)
  • Screenshot capture for debugging
  • Headless or GUI Chrome mode
  • CLI with --dry-run, site selection, etc.
  • systemd timer integration for scheduled execution

Table of Contents

Prerequisites

  • Python >= 3.10
  • Google Chrome browser (not installable via pip -- must be installed separately)

Installation

Homebrew (macOS)

brew install shigechika/tap/speedtest-z

pip

pip install speedtest-z

Development Setup

git clone https://github.com/shigechika/speedtest-z.git
cd speedtest-z
python3 -m venv .venv
. .venv/bin/activate
pip install -e .

Dependencies

Grafana Cloud Support (optional)

pip install speedtest-z[grafana]

This installs cramjam for Snappy compression required by Prometheus Remote Write.

OpenTelemetry Support (optional)

pip install speedtest-z[otel]

This installs the OpenTelemetry SDK and OTLP HTTP exporter for sending metrics via OTLP.

Tab Completion (optional)

pip install speedtest-z[completion]
eval "$(register-python-argcomplete speedtest-z)"

Add the eval line to your shell profile (~/.bashrc or ~/.zshrc) to enable it permanently.

Configuration

config.ini

The configuration file is searched in the following order (-c / --config can override):

  1. ./config.ini in the current directory
  2. ~/.config/speedtest-z/config.ini (XDG_CONFIG_HOME)

Copy config.ini-sample to one of these locations and edit as needed.

Sections

[general]
# Run mode
dry_run = true         # true = do not send data to backends
headless = false       # true = run Chrome in headless mode
timeout = 30           # timeout in seconds for each test
# ookla_server = IPA CyberLab 400G   # Ookla test server (omit for auto-select)

[zabbix]
# Zabbix server settings
enable = false           # true = send results to Zabbix
server = 127.0.0.1
port = 10051
host = speedtest-agent   # Zabbix host name for trapper items

[snapshot]
# Screenshot capture settings
enable = true
save_dir = ./snapshots

[frequency]
# Execution probability per site (0-100)
# 100 = always run, 50 = ~50% chance, 0 = disabled
cloudflare = 100
netflix = 100
google = 100
ookla = 50
boxtest = 50
mlab = 10
usen = 50
inonius = 50

# [grafana]
# # Grafana Cloud Prometheus Remote Write
# enable = false
# remote_write_url = https://prometheus-prod-XX-prod-XX.grafana.net/api/prom/push
# username =
# token =

# [otel]
# # OpenTelemetry (OTLP) metrics export
# enable = false
# endpoint = https://otlp-gateway-prod-XX.grafana.net/otlp
# # Comma-separated Key=Value pairs (same format as OTEL_EXPORTER_OTLP_HEADERS)
# headers = Authorization=Basic <base64-encoded-credentials>

Note: The dryrun key (without underscore) is still supported for backward compatibility but dry_run is preferred.

logging.ini

An optional logging.ini file can be used to customize log output. The file is searched in the same order as config.ini:

  1. ./logging.ini in the current directory
  2. ~/.config/speedtest-z/logging.ini (XDG_CONFIG_HOME)

If neither is found, the default logging configuration (INFO level to stdout) is used.

Usage

speedtest-z [options] [site ...]

Options

Option Description
-V, --version Show program version and exit
-c, --config CONFIG Config file path (default: ./config.ini or ~/.config/speedtest-z/config.ini)
-n, --dry-run Test run (do not send data to Zabbix)
--headless Run Chrome in headless mode
--no-headless, --headed Run Chrome with GUI (non-headless)
--timeout SECONDS Timeout in seconds for each test
--list-sites List available test sites and exit
--check Check site URL reachability and exit (no Chrome needed)
-o, --output FORMAT Output format: zabbix (default), json, csv
-d, --debug Enable debug output
site Positional argument(s): test site(s) to run (default: all)

Confirmation Prompt

When run from an interactive terminal (TTY), speedtest-z asks for confirmation before connecting to test sites. Non-interactive environments (cron, systemd, piped input) skip the prompt automatically.

$ speedtest-z -n
speedtest-z: connecting to 8 site(s) (cloudflare, netflix, ...)
Continue? [y/N]: y

Examples

# Run all test sites (dry-run)
speedtest-z -n

# Run specific sites
speedtest-z cloudflare netflix

# Run with GUI browser for debugging
speedtest-z --no-headless -d cloudflare

# List available sites
speedtest-z --list-sites

# Check if all test site URLs are reachable (no Chrome needed)
speedtest-z --check

# Check specific sites only
speedtest-z --check cloudflare netflix

# Output results as JSON (Zabbix send is skipped)
speedtest-z --dry-run --output json cloudflare 2>/dev/null

# Output results as CSV
speedtest-z --dry-run -o csv cloudflare netflix 2>/dev/null

Example Output

Measured at JANOG57 Meeting (Feb 2026, Osaka):

$ speedtest-z --dry-run
2026-02-13 09:39:27 [INFO] speedtest-z: START
2026-02-13 09:39:27 [INFO] Config loaded: config.ini
2026-02-13 09:39:27 [INFO] Initializing Chrome WebDriver...
2026-02-13 09:39:28 [INFO] cloudflare: OPEN
2026-02-13 09:39:35 [INFO] cloudflare: Test started
2026-02-13 09:40:24 [INFO] cloudflare: COMPLETED (Quality Scores appeared)
2026-02-13 09:40:27 [INFO] Dryrun: True - Data not sent.
2026-02-13 09:40:27 [INFO] netflix: OPEN
2026-02-13 09:40:53 [INFO] netflix: COMPLETED (succeeded class detected)
2026-02-13 09:40:53 [INFO] google: OPEN
2026-02-13 09:41:20 [INFO] google: COMPLETED
2026-02-13 09:41:20 [INFO] ookla: OPEN (Attempt 1/3)
2026-02-13 09:42:00 [INFO] ookla: COMPLETED
2026-02-13 09:42:02 [INFO] boxtest: OPEN
2026-02-13 09:43:17 [INFO] boxtest: COMPLETED
2026-02-13 09:43:17 [INFO] mlab: OPEN
2026-02-13 09:44:05 [INFO] mlab: COMPLETED
2026-02-13 09:44:05 [INFO] usen: OPEN
2026-02-13 09:44:34 [INFO] usen: COMPLETED (speedtest_wait class removed)
2026-02-13 09:44:34 [INFO] inonius: OPEN
2026-02-13 09:45:31 [INFO] inonius: COMPLETED
2026-02-13 09:45:31 [INFO] speedtest-z: FINISH

All 8 sites completed in about 6 minutes.

Supported Test Sites

Site URL Metrics (Zabbix keys)
cloudflare https://speed.cloudflare.com/ download, upload, latency, jitter
netflix https://fast.com/ download, upload, latency, server-locations
google http://speed.googlefiber.net/ download, upload, ping
ookla https://www.speedtest.net/ download, upload, ping
boxtest https://www.box-test.com/ POP, DownloadSpeed, DownloadDuration, DownloadRTT, UploadSpeed, UploadDuration, UploadRTT, latency
mlab https://speed.measurementlab.net/ download, upload, latency, retrans
usen https://speedtest.gate02.ne.jp/ download, upload, ping, jitter
inonius https://inonius.net/speedtest/ IPv4/IPv6: DL, UL, RTT, JIT, MSS

All Zabbix item keys are prefixed with the site name (e.g., cloudflare.download, usen.ping, inonius.IPv4_DL).

Note: Google Fiber (speed.googlefiber.net) and jumbo frames

speed.googlefiber.net does not support HTTPS (HTTP only) and has no AAAA records. In IPv6-only environments it is accessed via DNS64/NAT64, but if the NIC MTU is set to 9000 (jumbo frames), the page JavaScript fails to load and the screen stays blank. Set the MTU to 1500.

Zabbix Integration

  1. Import the speedtest-z_templates.yaml template into Zabbix.
  2. All items are trapper type -- the agent pushes data to Zabbix using the zappix sender protocol.
  3. Set enable = true in the [zabbix] section of config.ini.
  4. The host value in config.ini must match the host name registered in Zabbix.

Grafana Cloud Integration

Grafana Dashboard

speedtest-z can push metrics to Grafana Cloud via Prometheus Remote Write.

  1. Install with Grafana support: pip install speedtest-z[grafana]
  2. Add the [grafana] section to config.ini:
[grafana]
enable = true
remote_write_url = https://prometheus-prod-XX-prod-XX.grafana.net/api/prom/push
username = <your-prometheus-username>
token = <your-grafana-cloud-api-token>
  1. Metrics are sent as speedtest_<metric> with a site label (e.g., speedtest_download{site="cloudflare"}).
  2. Both Zabbix and Grafana can be enabled simultaneously -- results are sent to all enabled backends.

OpenTelemetry (OTLP) Integration

speedtest-z can export metrics via OpenTelemetry Protocol (OTLP) to any OTLP-compatible backend.

  1. Install with OTel support: pip install speedtest-z[otel]
  2. Add the [otel] section to config.ini:
[otel]
enable = true
endpoint = https://otlp-gateway-prod-XX.grafana.net/otlp
headers = Authorization=Basic <base64-encoded-credentials>
  1. Metrics are sent as speedtest_<metric> with site and host labels.
  2. All three backends (Zabbix, Grafana, OTel) can be enabled simultaneously.

Note: As of Feb 2026, direct OTLP metrics ingestion (without a collector) on free tier accounts is supported by very few backends. Grafana Cloud is the most mature option. Mackerel, GCP Cloud Monitoring, and AWS CloudWatch currently support OTLP traces only; Datadog requires an allowlisted organization. Paid plans may offer broader OTLP metrics support.

Deployment (systemd)

The deploy/ directory contains systemd unit files for scheduled execution:

File Description
speedtest-z.service Service unit (runs speedtest-z from the venv)
speedtest-z.timer Timer unit (runs every 6 minutes)
SeleniumCleaner.cron Cron job to clean up stale Chrome temp files

Setup

# Copy unit files
cp deploy/speedtest-z.service ~/.config/systemd/user/
cp deploy/speedtest-z.timer ~/.config/systemd/user/

# Reload and enable
systemctl --user daemon-reload
systemctl --user enable --now speedtest-z.timer

# Check status
systemctl --user status speedtest-z.timer
systemctl --user list-timers

Optionally, install the cron job for cleaning up stale Chrome temporary directories:

sudo cp deploy/SeleniumCleaner.cron /etc/cron.d/SeleniumCleaner

Share Your Results!

Got the fastest or slowest speed test result? We'd love to see it!

Submit your results via GitHub Issues with:

  • Screenshot(s) from the snapshots/ directory
  • CLI log output (speedtest-z --dry-run)

Whether it's blazing fast datacenter fiber or painfully slow hotel Wi-Fi, all results are welcome.

License

Apache License 2.0

Copyright 2026 AIKAWA Shigechika

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speedtest_z-0.7.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speedtest_z-0.7.1-py3-none-any.whl (50.3 kB view details)

Uploaded Python 3

File details

Details for the file speedtest_z-0.7.1.tar.gz.

File metadata

  • Download URL: speedtest_z-0.7.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for speedtest_z-0.7.1.tar.gz
Algorithm Hash digest
SHA256 7f67ef2ba7b0a5b2326bafc5209ccf891853a94d2391dc7bff3f1fb0e3690e80
MD5 8b8ff89badee10a411e743e3151b434c
BLAKE2b-256 ef54482119d1aa1322566c47007ccd65c0113a7c4ec5a1c3360717252b14eca8

See more details on using hashes here.

Provenance

The following attestation bundles were made for speedtest_z-0.7.1.tar.gz:

Publisher: release.yml on shigechika/speedtest-z

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file speedtest_z-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: speedtest_z-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 50.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for speedtest_z-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e52858264a5f9a6526fa622d4eb6d7d969ee95293a3fd6e65db5af713741c2b9
MD5 40011ed000cde3aebde2dd1f8268c32b
BLAKE2b-256 032c216eaead7460c3919c6b27ae8d6651ab3987e9a1c29a4c81fc706ecf8c2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for speedtest_z-0.7.1-py3-none-any.whl:

Publisher: release.yml on shigechika/speedtest-z

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page