mirror of
https://gitlab.com/iscmt/homehub4000-prometheus-exporter.git
synced 2026-04-04 09:22:24 -04:00
main
HomeHub 4000 Prometheus Exporter
Prometheus exporter for the Virgin Plus Vincent / Bell HomeHub 4000 router. Uses Playwright to scrape the admin UI and expose metrics for Prometheus. Device events are stored in SQLite so other tools can query them independently of Prometheus.
Architecture diagram
flowchart LR
subgraph exporter.py
direction TB
prom[Prometheus Server]
scraper[router_scraper.py]
poller[router_log_fetcher.py]
end
subgraph Router["HomeHub 4000"]
mon["/monitoring"]
stats["/statistics"]
logs["/logs"]
end
scraper --> mon
scraper --> stats
poller --> logs
poller --> db[(SQLite)]
Quick Start
# Install
uv sync
uv run playwright install chromium
# Run
ROUTER_PASSWORD="your_password" uv run python src/exporter.py
# Check
curl http://localhost:9100/metrics | grep homehub_
Docker
cd deploy
echo "ROUTER_PASSWORD=your_password" > .env
docker-compose up -d
Services:
- Exporter: http://localhost:9100/metrics
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3000 (pre-configured dashboard included)
Default Grafana credentials are admin/admin. Override with GRAFANA_ADMIN_USER and GRAFANA_ADMIN_PASSWORD in .env.
Configuration
| Variable | Default | Description |
|---|---|---|
ROUTER_PASSWORD |
(required) | Router admin password |
ROUTER_IP |
192.168.2.1 | Router IP address |
EXPORTER_PORT |
9100 | Metrics port |
SCRAPE_INTERVAL |
60 | Seconds between scrapes |
LOG_POLL_INTERVAL |
75 | Seconds between log polls |
HEADLESS_BROWSER |
true | Run browser headless |
Metrics
All metrics prefixed with homehub_. Covers system health (CPU, memory, load), network interfaces (status, throughput, errors), connected devices, router uptime, and log statistics. See the Grafana dashboard screenshot above or query curl localhost:9100/metrics | grep homehub_ for the full list.
Development
uv sync # includes dev dependencies
uv run pytest
uv run ruff check src/
Troubleshooting
- Set
HEADLESS_BROWSER=falseto watch the browser and debug scraping issues - Delete
virgin_monitor.dbto reset device history
Tested on Virgin Plus Vincent (Bell HomeHub 4000), firmware 2.13, UI 7.3.29.
Languages
Python
98.4%
Dockerfile
1.6%
