kbknapp / wireguard_exporter

A Prometheus exporter for WireGuard
Apache License 2.0
30 stars 3 forks source link

Wireguard connection detection #13

Open martyy665 opened 3 months ago

martyy665 commented 3 months ago

Hi there, I have tried the SW on two independent Debian 12 machines. On both, a wireguard interface is configured and working OK. Running as sudo, I get this output (regardless of verbosity set):

root@martyy-ntb:/home/martyy/projects/Prometheus/wg_exporter/git/wireguard_exporter/target/release# sudo ./wireguard_exporter -vv
2024-07-07T18:38:01.567869Z  INFO wireguard_exporter: Registering metrics...
2024-07-07T18:38:01.567925Z  INFO wireguard_exporter: Spawning server...
2024-07-07T18:38:01.567933Z  INFO wireguard_exporter: Collecting metrics...
2024-07-07T18:38:01.568116Z  INFO prometheus_hyper: starting hyper server to serve metrics
2024-07-07T18:38:01.569724Z  INFO wireguard_exporter: Collecting metrics...
2024-07-07T18:38:06.569237Z  INFO wireguard_exporter: Collecting metrics...
2024-07-07T18:38:11.569793Z  INFO wireguard_exporter: Collecting metrics...
2024-07-07T18:38:16.569782Z  INFO wireguard_exporter: Collecting metrics...
2024-07-07T18:38:21.569817Z  INFO wireguard_exporter: Collecting metrics...
2024-07-07T18:38:26.569409Z  INFO wireguard_exporter: Collecting metrics...
2024-07-07T18:38:31.569560Z  INFO wireguard_exporter: Collecting metrics...

The process is listening on the right port, but Error 404 is always returned:

root@martyy-ntb:/home/martyy/.ssh# wget 127.0.0.1:9586
--2024-07-07 20:38:08--  http://127.0.0.1:9586/
Connecting to 127.0.0.1:9586... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-07-07 20:38:08 ERROR 404: Not Found.

Moreover, with self-compiled binary, the result is same. Can I omit some necessary parameter like for example wg interface name?

matejgordon commented 3 months ago

You have to go to /metrics not just the plain host url.

for example: http://127.0.0.1:9586/metrics