# Speedtest Tracker with InfluxDB

> Automated internet speed testing with tracking.

- Category: Home Lab & Self-Hosting
- Difficulty: beginner
- Components: speedtest-tracker, influxdb, grafana
- Tags: speedtest, monitoring, network, metrics
- Source: https://docker.recipes/homelab/speedtest-tracker-stack

## Overview

Speedtest Tracker is a self-hosted Laravel application that automatically runs internet speed tests using the official Speedtest CLI and stores the results for historical analysis. Originally created to address the need for consistent, automated monitoring of internet connection quality, it provides a clean web interface for viewing speed test results and trends over time. The application eliminates the need to manually run speed tests and provides concrete data when dealing with ISP performance issues or network troubleshooting.

This monitoring stack combines Speedtest Tracker's automated testing capabilities with InfluxDB's time-series database optimized for storing timestamped speed test metrics, and Grafana's powerful visualization platform for creating detailed network performance dashboards. InfluxDB's high-performance time-series storage handles the continuous flow of speed test data efficiently, while Grafana transforms raw metrics into actionable insights through customizable charts, alerts, and trend analysis. The integration allows for sophisticated monitoring that goes beyond simple pass/fail metrics to track performance patterns, identify peak usage impacts, and correlate speed degradation with specific time periods.

Homelab enthusiasts, remote workers, and small businesses who depend on reliable internet connectivity will find this stack invaluable for documenting network performance and holding ISPs accountable for service level agreements. The combination is particularly useful for users who experience intermittent connectivity issues that are difficult to reproduce when contacting support, as it provides historical evidence of performance problems with precise timestamps and measurements.

## Features

- Automated speed testing every 4 hours using official Speedtest CLI with customizable cron scheduling
- InfluxDB 2.0 time-series storage with built-in data retention policies for managing long-term speed test history
- Grafana dashboard creation with pre-built speedtest visualization templates and alerting capabilities
- Speedtest Tracker web interface showing download/upload speeds, ping latency, and ISP information
- InfluxDB Flux query language support for advanced analytics like percentile calculations and moving averages
- Grafana's 50+ data source integration allowing correlation with other network monitoring tools
- Historical trend analysis with InfluxDB's continuous queries for automatic data aggregation
- Multi-server speedtest support in Speedtest Tracker for testing against different geographic locations

## Use cases

- Home office workers documenting internet performance for employer reimbursement or upgrade justification
- Small businesses monitoring SLA compliance and collecting evidence for ISP service disputes
- Homelab administrators tracking network performance impact when adding new services or users
- Remote workers correlating video call quality issues with specific bandwidth degradation periods
- Network administrators comparing performance across multiple ISPs or connection types
- Content creators monitoring upload speeds for streaming and video upload scheduling optimization
- Troubleshooting intermittent connectivity issues by identifying patterns in speed degradation over time

## Prerequisites

- Minimum 1.5GB RAM for InfluxDB (1GB) and Grafana (512MB) with additional overhead for Speedtest Tracker
- Available ports 3000 (Grafana), 8080 (Speedtest Tracker), and 8086 (InfluxDB) or alternative port configuration
- Docker host with stable internet connection capable of running automated speed tests without interference
- Environment variables configured: INFLUX_USER, INFLUX_PASSWORD, and GRAFANA_PASSWORD for service authentication
- Understanding of InfluxDB bucket and organization concepts for configuring data export from Speedtest Tracker
- Basic Grafana dashboard creation knowledge for building custom speedtest visualizations beyond default views

## docker-compose.yml

```yaml
services:
  speedtest-tracker:
    image: ghcr.io/alexjustesen/speedtest-tracker:latest
    container_name: speedtest-tracker
    restart: unless-stopped
    ports:
      - "${SPEEDTEST_PORT:-8080}:80"
    environment:
      - PUID=1000
      - PGID=1000
      - DB_CONNECTION=sqlite
      - SPEEDTEST_SCHEDULE=0 */4 * * *
    volumes:
      - speedtest_config:/config

  influxdb:
    image: influxdb:2
    container_name: speedtest-influxdb
    restart: unless-stopped
    ports:
      - "${INFLUX_PORT:-8086}:8086"
    environment:
      - DOCKER_INFLUXDB_INIT_MODE=setup
      - DOCKER_INFLUXDB_INIT_USERNAME=${INFLUX_USER}
      - DOCKER_INFLUXDB_INIT_PASSWORD=${INFLUX_PASSWORD}
      - DOCKER_INFLUXDB_INIT_ORG=homelab
      - DOCKER_INFLUXDB_INIT_BUCKET=speedtest
    volumes:
      - influxdb_data:/var/lib/influxdb2

  grafana:
    image: grafana/grafana:latest
    container_name: speedtest-grafana
    restart: unless-stopped
    ports:
      - "${GRAFANA_PORT:-3000}:3000"
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
    volumes:
      - grafana_data:/var/lib/grafana

volumes:
  speedtest_config:
  influxdb_data:
  grafana_data:
```

## .env

```bash
# Speedtest Tracker
SPEEDTEST_PORT=8080
INFLUX_PORT=8086
INFLUX_USER=admin
INFLUX_PASSWORD=influx_password
GRAFANA_PORT=3000
GRAFANA_PASSWORD=admin
```

## Usage notes

- Speedtest at http://localhost:8080
- Grafana at http://localhost:3000
- Tests run every 4 hours
- Export to InfluxDB in settings

## Troubleshooting

- Speedtest CLI not found or failing: Ensure container has internet access and Speedtest servers are reachable from your network location
- InfluxDB connection refused from Speedtest Tracker: Verify INFLUX_USER credentials and check that InfluxDB initialization completed successfully with docker logs speedtest-influxdb
- Grafana shows no data from InfluxDB: Confirm InfluxDB data source configuration uses correct bucket name 'speedtest' and organization 'homelab' with proper authentication token
- Speed tests not running on schedule: Check Speedtest Tracker logs for cron execution errors and verify SPEEDTEST_SCHEDULE environment variable format
- InfluxDB out of memory errors: Increase container memory limits or configure data retention policies to automatically delete old speedtest data
- Grafana dashboard queries timing out: Optimize InfluxDB queries using appropriate time ranges and consider using InfluxDB continuous queries for pre-aggregated data

