Monitoring tools

I am starting with the answer from today meeting regarding Nyx

" Some folks have migrated from nyx to grafana + prometheus."

How can i add my TOR Relays, Obfs4 bridges and snowfkakes to be monitored by grafana + prometheus.?

Hi,

This can be done with MetricsPort. For example by putting MetricsPort 1.2.3.4:9035 in your torrc file (for each relay).

Step 2 is to install Prometheus and configure Prometheus to query the MetricsPort IP:port (e.g. every minute). Make sure that this data is 1. only accessible for your Prometheus server (e.g. MetricsPortPolicy accept 1.2.3.4 or firewall) and 2. is encrypted in transit, for example by putting a proxy with TLS (webserver) before it (if there is transit).

Step 3 is to install Grafana and make it use the Prometheus data and create some nice graphs. There are also some community graphs here and there.

If you’re running multiple relays you can just use successive port numbers, like 9035, 9036 etc. But you can also run Prometheus locally on your Tor server and combine all your MetricsPort data there and make the external Prometheus on your collection/visualization server collect them in bulk.

To be honest, it’s quite a elaborate setup. When running multiple relays it gives some great insight to your Tor relay’s and DNS (in case of exit relays) health, utilization, errors, bugs etc. And you can combine the data with general node_exporter server metrics data as well. I wouldn’t want to run Tor without it now that I have it. But to be fair, it really takes some time to set it up and it also requires quite some hardware resources, especially with some more fine-grained data points.

You should be able to find guides for every step I mention here, but feel free to ask more questions. I have this setup running without any prior experience with Prometheus and Grafana, but it took quite some time to get a grasp on everything (especially Grafana’s inner workings). So I gladly help others if it can save them time :slight_smile: .

1 Like

For a Prometheus config take a look here: torutils/dashboards at main · toralf/torutils · GitHub .

1 Like