A self-hosted bandwidth monitoring application that periodically runs speed tests and displays results on a web dashboard. Built in Go with no external runtime dependencies.
- Automatic speed tests at configurable intervals
- Measures download speed, upload speed, and latency
- Web dashboard with interactive charts
- Historical data stored in SQLite
- REST API for programmatic access
- Single binary deployment
- Cross-platform (Linux, macOS, Windows, ARM64)
The dashboard displays current speed, historical statistics, and a time-series chart of your connection performance.
git clone https://github.com/karlobrien/bandwidth_monitor.git
cd bandwidth_monitor
go build -o bandwidth-monitor .
./bandwidth-monitorOpen http://localhost:8080 in your browser.
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bandwidth-monitor-arm64 .Configuration is done via environment variables:
| Variable | Default | Description |
|---|---|---|
PORT |
8080 |
Web server port |
TEST_INTERVAL |
1h |
Time between speed tests (e.g., 30m, 2h) |
DB_PATH |
./bandwidth.db |
SQLite database file path |
RUN_ON_STARTUP |
true |
Run a speed test immediately on startup |
ADVERTISED_SPEED_MBPS |
- | Your expected speed for comparison |
Example:
TEST_INTERVAL=30m PORT=3000 ./bandwidth-monitor| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Web dashboard |
/health |
GET | Health check (returns ok) |
/api/results |
GET | Speed test results (JSON) |
/api/stats |
GET | Aggregate statistics (JSON) |
/api/test |
POST | Trigger an immediate speed test |
GET /api/results
limit- Number of results to return (default: 100)offset- Pagination offset (default: 0)
# Get recent results
curl http://localhost:8080/api/results?limit=10
# Get statistics
curl http://localhost:8080/api/stats
# Trigger a speed test
curl -X POST http://localhost:8080/api/test- Copy the binary to your Pi:
scp bandwidth-monitor-arm64 user@pi:~/bandwidth-monitor/bandwidth-monitor- Copy the service file:
scp bandwidth-monitor.service user@pi:~/- On the Pi, install and enable the service:
chmod +x ~/bandwidth-monitor/bandwidth-monitor
sudo mv ~/bandwidth-monitor.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable bandwidth-monitor
sudo systemctl start bandwidth-monitor- Check status:
sudo systemctl status bandwidth-monitor
journalctl -u bandwidth-monitor -fFROM golang:1.21-alpine AS builder
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 go build -o bandwidth-monitor .
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/bandwidth-monitor .
EXPOSE 8080
CMD ["./bandwidth-monitor"]bandwidth_monitor/
├── main.go # Application entry point
├── config/ # Configuration loading
├── speedtest/ # Speed test execution (uses speedtest.net)
├── scheduler/ # Periodic test scheduling
├── storage/ # SQLite database operations
└── web/ # HTTP server and dashboard
└── templates/ # HTML dashboard template
- On startup, the application initializes a SQLite database and starts a scheduler
- The scheduler triggers speed tests at the configured interval
- Each test selects the best server from 5 candidates based on latency
- Results (download, upload, latency) are stored in the database
- The web dashboard fetches and displays data via the REST API
- Language: Go
- Database: SQLite (pure-Go driver, no CGO)
- Speed Test: speedtest-go library
- Frontend: Vanilla HTML/CSS/JavaScript with Chart.js
MIT