mdlayher / wireguard_exporter

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

add network namespace support #1

Closed alex-laties closed 4 years ago

alex-laties commented 4 years ago

I have a use case where I want to scrape multiple network namespaces with wireguard interfaces in each one. I don't want to have to spin up an exporter per network namespace though.. so I figured it was much simpler to just allow the exporter to switch between the namespaces during collection.

Seems to work as is, but definitely open to comments and suggestions.

mdlayher commented 4 years ago

Thank you for your time and effort, but I'm not interested in merging this change.

Manipulating the network namespace from within a Go program is Linux-specific and requires great care. Although this PR would work, wgctrl-go only makes an effort to support features which are available across both kernel and userspace WireGuard implementations.

Since this change would add complexity to the exporter and make it more difficult to make it run on non-Linux machines, I would prefer the approach of running an exporter per namespace, if that sort of specialized configuration is required.

Thanks for your time.