Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple IP addreses #8

Closed
schoentoon opened this issue Jul 9, 2019 · 6 comments
Closed

Support multiple IP addreses #8

schoentoon opened this issue Jul 9, 2019 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@schoentoon
Copy link

I have my wireguard configured to allow for multiple ip addresses per peer (generally ipv4 and ipv6). This is simply done like this

[Peer]
PublicKey = <snip>
AllowedIPs = 10.0.0.2/32, fd86:ea04:::4/128

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.

@MindFlavor
Copy link
Owner

MindFlavor commented Jul 9, 2019

You are indeed right, I haven't considered the possibility of allowing multiple IP addresses 🤦‍♂️ . 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.

@MindFlavor MindFlavor added the bug Something isn't working label Jul 9, 2019
@MindFlavor MindFlavor self-assigned this Jul 9, 2019
@MindFlavor
Copy link
Owner

I have a working solution based on the second approach. Please check out if it solves your problem!

@schoentoon
Copy link
Author

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 :)

@MindFlavor
Copy link
Owner

Makes perfect sense. I will implement the second approach behind a startup flag.
I will also correct the inteface :D

@MindFlavor
Copy link
Owner

ok in #9 I've implemented your suggestions. Let me know if it's ok by you!

@schoentoon
Copy link
Author

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 😅
Thanks for the quick fixing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants