Closed schoentoon closed 5 years ago
You are indeed right, I haven't considered the possibility of allowing multiple IP addresses :man_facepalming: . I can fix this but I do not know how to express multiple IPs as Prometheus label(s). Should we drop the local_subnet
label and replace local_ip
with a simpler allowed_ips
?
Alternatively we can have local_ip_1
, local_subnet_1
, local_ip_2
, local_subnet_2
, and so on but it's ugly.
@schoentoon what do you think we should do? I'm partial for the first approach.
I have a working solution based on the second approach. Please check out if it solves your problem!
The second approach seems better for users with only one or two ip addresses, but the first option would be better for people with a lot of ip addresses. Maybe make it configurable?
Also, while looking at this ticket again I noticed that the first label is called inteface
rather than interface
, thought this could have been a copy paste failure on my end. Turns out it isn't, may want to fix that too :)
Makes perfect sense. I will implement the second approach behind a startup flag.
I will also correct the inteface
:D
ok in https://github.com/MindFlavor/prometheus_wireguard_exporter/pull/9 I've implemented your suggestions. Let me know if it's ok by you!
Deployed it on my infrastructure and instantly looks a lot better. I'll have to tweak my grafana dashboards a bit now, but that's just a detail :sweat_smile: Thanks for the quick fixing :)
I have my wireguard configured to allow for multiple ip addresses per peer (generally ipv4 and ipv6). This is simply done like this
However the eventual prometheus labels don't seem to pick up on this all too well. As I get the following labels:
wireguard_sent_bytes_total{inteface="wg0", public_key="<snip>", local_ip="10.0.0.2", local_subnet="32,fd86:ea04:::2"}
It seems to me that it is doing a simple split on the
/
and just uses the entire output after that as the local subnet.