friendly_names for multiple configfiles
perbly opened this issue · 2 comments
perbly commented
Hi
Thanks for a great exporter.
I´m having issues getting friendly_names working for multiple files.
Maybe i´m doing something wrong i don´t know.
Here´s my systemd conf for the exporter:
Environment=PROMETHEUS_WIREGUARD_EXPORTER_ADDRESS=192.168.0.1
Environment=PROMETHEUS_WIREGUARD_EXPORTER_CONFIG_FILE_NAMES=/etc/wireguard/wg1.conf
Environment=PROMETHEUS_WIREGUARD_EXPORTER_CONFIG_FILE_NAMES=/etc/wireguard/wg2.conf
Environment=EXPORT_LATEST_HANDSHAKE_DELAY=true
And content of these files:
wg1.conf
...
[Peer]
# some custom comment
# friendly_name = paris - oslo
PublicKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXX
AllowedIPs = 192.32.0.0/16
Endpoint = wireguard.example.com:51821
wg2.conf
...
[Peer]
# some custom comment
# friendly_name = forest - ocean
PublicKey = XXXXXXXXXXXXXXXXXXXXXXXXXX
AllowedIPs = 192.35.0.0/16
Endpoint = wireguard2.example.com:51821
Result of metrics:
wireguard_sent_bytes_total{interface="wg1",public_key="XXXXXXXXXXXXXXXXXXXXXXXXXX=",allowed_ips="192.32.0.0/16"} 4569900
wireguard_sent_bytes_total{interface="wg2",public_key="XXXXXXXXXXXXXXXXXXXXXXXXXX=",allowed_ips="192.35.0.0/16",friendly_name="forest - ocean"} 6382416
I´m i doing something wrong?
Thanks
finnje commented
What's happening is you are overwriting PROMETHEUS_WIREGUARD_EXPORTER_CONFIG_FILE_NAMES the second time you set it. You need to have this single line instead of the two you are using.
Environment=PROMETHEUS_WIREGUARD_EXPORTER_CONFIG_FILE_NAMES="/etc/wireguard/wg1.conf /etc/wireguard/wg2.conf"
perbly commented
Ok thanks. That worked