MindFlavor / prometheus_wireguard_exporter

A Prometheus exporter for WireGuard, written in Rust.
https://mindflavor.github.io/prometheus_wireguard_exporter
MIT License
492 stars 51 forks source link

No output when peer config is split #22

Closed vdebergue closed 4 years ago

vdebergue commented 4 years ago

Hi, I'm running the exporter with a separate peer file:

/usr/local/bin/prometheus_wireguard_exporter -n /etc/wireguard/peers.conf

This causes the exporter to believe that the interface is named peers whereas the correct name is wg0

My wg0.conf:

[Interface]
Address = <network>/24
PrivateKey = <private_key>
ListenPort = 51280
PostUp = wg addconf wg0 /etc/wireguard/peers.conf

This allows to split the configuration file in two and manage user configuration separately.

Maybe we could add an option on the command line that would take the precedence on the filename if specified ?

MindFlavor commented 4 years ago

Yes it makes sense. 👍

MindFlavor commented 4 years ago

@vdebergue Can you please test the aforementioned PR and tell me how it goes? I've tested it on my env and it seems to work (with both single config file and splitted ones).

vdebergue commented 4 years ago

I will try it next week, thanks.

vdebergue commented 4 years ago

The new branch is working for my setup 👍

MindFlavor commented 4 years ago

Nice! Thank you for testing! As soon as I update the README I will merge the PR, publish it in crates.io and close this issue!