MindFlavor / prometheus_wireguard_exporter

A Prometheus exporter for WireGuard, written in Rust.
https://mindflavor.github.io/prometheus_wireguard_exporter
MIT License
492 stars 51 forks source link

Handle missing WireGuard better #114

Open vilhelmprytz opened 1 year ago

vilhelmprytz commented 1 year ago

If the exporter is run on a machine that does not have WireGuard installed, the following error occurs when querying the exporter.

[2023-07-31T09:24:43Z WARN  prometheus_exporter_base] internal server error == Os { code: 2, kind: NotFound, message: "No such file or directory" }

And the returned HTTP response looks like this.

# curl localhost:9586/metrics
No such file or directory (os error 2)#

It would be nice if the exporter still returned some metadata metrics, and perhaps a metric that indicates whether scraping wg was successful or not, like wireguard_exporter_up or something like that.