mdlayher / wireguard_exporter

Command wireguard_exporter implements a Prometheus exporter for WireGuard devices. MIT Licensed.
MIT License
118 stars 26 forks source link

Include peer configured names in metric label values #17

Open crockk opened 3 years ago

crockk commented 3 years ago

Hi, I noticed my configured names aren't appearing in any metric except wireguard_peer_info. The name label does not appear in any of the other metrics (keys redacted):

# TYPE wireguard_peer_info gauge
wireguard_peer_info{device="wg0",endpoint="",name="ethan-phone",public_key="a"} 1
wireguard_peer_info{device="wg0",endpoint="",name="nolan-desktop",public_key="b"} 1
wireguard_peer_info{device="wg0",endpoint="",name="nolan-laptop",public_key="c"} 1
wireguard_peer_info{device="wg0",endpoint="xx",name="carolyn-iphone",public_key="d="} 1
wireguard_peer_info{device="wg0",endpoint="xx",name="nolan-iphone",public_key="e"} 1
# HELP wireguard_peer_last_handshake_seconds UNIX timestamp for the last handshake with a given peer.
# TYPE wireguard_peer_last_handshake_seconds gauge
wireguard_peer_last_handshake_seconds{device="wg0",public_key="a"} 0
wireguard_peer_last_handshake_seconds{device="wg0",public_key="b"} 0
wireguard_peer_last_handshake_seconds{device="wg0",public_key="c"} 1.621761377e+09
wireguard_peer_last_handshake_seconds{device="wg0",public_key="d"} 1.621805472e+09
wireguard_peer_last_handshake_seconds{device="wg0",public_key="e"} 0

Is this a problem on my end or is it just not implemented? Could we include these labels in the other metrics?

crockk commented 3 years ago

Oh, nevermind, I guess it just needed a second to update. Closing

crockk commented 3 years ago

Wait, no, I was right, it's not included. The example dashboard uses joins. Why not include the label in the metric directly?

tacerus commented 3 years ago

I'm confused what the "name" value even does. I configured it expecting it to make it easier to differentiate between multiple tunnels, similar as the "sister project" https://github.com/MindFlavor/prometheus_wireguard_exporter does, but now realize that the value seems to not fulfill any purpose at all.

Would appreciate if someone implements this for a future release. :)

tacerus commented 3 years ago

@crockk How did you get the name into some of your sample metrics? I cannot see it anywhere in my /metrics. I am using the .toml config.

tacerus commented 3 years ago

Ah, nevermind. Now got it too. Heh.