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

Permission denied (os error 13) when using friendly_name attribute #127

Open
dholukeval opened this issue Jun 17, 2024 · 2 comments
Open

Comments

@dholukeval
Copy link

I have VM instance running on Azure with Ubuntu 22.04. It is a Wireguard VPN server. I want to setup Prometheus with Wireguard exporter to monitor the network. I can SSH into VM with SSH keys.

What I understood to use friendly_name I had to run the container with the options. So I could do something like:

docker run -d --privileged --net=host --cap-add=NET_ADMIN --name wgexporter mindflavor/prometheus-wireguard-exporter -d true -a true -v true

Above is working fine and I can do curl http:/localhost:9586/metrics and I can see metrics. I want to use friendly_name feature. So I had to run the container with -n /path/to/wg0.config. At the same time I had to mount the /etc/wireguard to the container with -v /etc/wireguard:/etc/wireguard. So the overall command is:

docker run -d --privileged --net=host --cap-add=NET_ADMIN --name wgexporter -v /etc/wireguard:/etc/wireguard mindflavor/prometheus-wireguard-exporter -d true -a true -v true -n /etc/wireguard/wg0.conf -i wg0

Container runs without any errors. But I can not curl http:/localhost:9586/metrics. It gives me an error: failed to read peer config file

I checked docker logs wgexporter outputs follwing:

[2024-06-17T09:59:47Z INFO  prometheus_wireguard_exporter] prometheus_wireguard_exporter v3.6.6 starting...
[2024-06-17T09:59:47Z INFO  prometheus_wireguard_exporter] using options: Options { verbose: true, prepend_sudo: true,      separate_allowed_ips: false, extract_names_config_files: Some(["/etc/wireguard/wg0.conf"]), interfaces: Some(["wg0"]), export_remote_ip_and_port: false, export_latest_handshake_delay: true }
[2024-06-17T09:59:47Z INFO  prometheus_wireguard_exporter] starting exporter on http://0.0.0.0:9586/metrics
[2024-06-17T09:59:47Z INFO  prometheus_exporter_base] Listening on http://0.0.0.0:9586/metrics
[2024-06-17T10:00:00Z TRACE prometheus_exporter_base] serve_function:: req.uri() == /metrics, req.method() == GET
[2024-06-17T10:00:00Z TRACE prometheus_exporter_base] received headers ==> 
host => localhost:9586
user-agent => curl/7.81.0
accept => */*
[2024-06-17T10:00:00Z TRACE prometheus_exporter_base] serve_function:: options == Options { verbose: true, prepend_sudo: true, separate_allowed_ips: false, extract_names_config_files: Some(["/etc/wireguard/wg0.conf"]), interfaces: Some(["wg0"]), export_remote_ip_and_port: false, export_latest_handshake_delay: true }
[2024-06-17T10:00:00Z TRACE prometheus_wireguard_exporter] interfaces_to_handle == ["wg0"]
[2024-06-17T10:00:00Z WARN  prometheus_exporter_base] internal server error == failed to read peer config file

Caused by:
    Permission denied (os error 13)

I gave all the necessary permission to the config file. I can see that the /etc/wireguard directory mounted on to the container as I can cd into it. I am still not able to solve this problem. Any help would be appreciated.

@muzzah
Copy link

muzzah commented Dec 16, 2024

Also getting this problem. Did you get this to work in the end @dholukeval ?

@chris-doco
Copy link

I got the mounting working by adding -v /etc/wireguard/wg0.conf:/etc/wireguard/wg0.conf:ro.

So my full command is

docker run -d --net=host --cap-add=NET_ADMIN -v /etc/wireguard/wg0.conf:/etc/wireguard/wg0.conf:ro --name=wgexporter mindflavor/prometheus-wireguard-exporter -a true -n /etc/wireguard/wg0.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants