Grafana dashboard to display stats from Tor node stored in prometheus DB
References
My git repo Guide is based on this guide on torproject.org
Getting started
NOTICE: Prometheus exporter is supported only by tor version 0.4.7.1-alpha on time of writing (Oct 2021)
- Enable prometheus exporter on tor process
“It’s important to understand that exposing tor metrics publicly is dangerous to the Tor network users. Please take extra precaution and care when opening this port. Set a very strict access policy with MetricsPortPolicy and consider using your operating systems firewall features for defence in depth.”
Add or comment following two tines to torrc file## Prometheus exporter MetricsPort x.x.x.x:9035 prometheus MetricsPortPolicy accept y.y.y.y
x.x.x.x is IP address where Tor process will listen for connection from prometheus.
DO NOT USE PUBLIC IP THERE. Use 127.0.0.1 if TOR and prometheus are running at same host
y.y.y.y is IP address from where TOR will accept connections. Keep it as restrictive as possible. Use 127.0.0.1 if TOR and prometheus are running at same host - Restart TOR process
- Configure job for prometheus to scrap data from tor
Add following to prometheus.yml configuration file
scrape_configs: # this line should be already in config - job_name: tor-exit metrics_path: /metrics scheme: http # https is not yet supported by tor static_configs: - targets: - x.x.x.x:9035
- Restart prometheus process
- Check prometheus console /targets that prometheus can scrap data from TOR
- Download tor_stats.json from git repo
- Go to your grafana and import new dashboard tor_stats.json. Point it to prometheus datasource