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

/metrics does not provide content #120

Open
nachogrxdev opened this issue Oct 22, 2023 · 5 comments
Open

/metrics does not provide content #120

nachogrxdev opened this issue Oct 22, 2023 · 5 comments

Comments

@nachogrxdev
Copy link

nachogrxdev commented Oct 22, 2023

To give you context, I have this docker compose that contains unbound, adguard and wireguard. In another docker compose I have all the services related to monitoring, prometheus, grafana, loki and others.

version: "3.9"

networks:
  traefik_network:
    external: true
  private_network:
    ipam:
      driver: default
      config:
        - subnet: 10.2.0.0/24

services:
  unbound:
    image: "mvance/unbound:latest"
    restart: unless-stopped
    hostname: "unbound"
    volumes:
      - "${PWD}/unbound:/opt/unbound/etc/unbound/"
    networks:
      private_network:
        ipv4_address: 10.2.0.200

  wireguard:
    depends_on: [unbound, adguard]
    image: linuxserver/wireguard
    container_name: wireguard
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - SERVERPORT=51820
      - SERVERURL=${SERVERURL}
      - PEERS=${PEERS}
      - PEERDNS=10.2.0.100
      - INTERNAL_SUBNET=10.6.0.0
    volumes:
      - "${PWD}/wireguard:/config"
      - "/lib/modules:/lib/modules"
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.udp.routers.wireguard.entrypoints=wireguard"
      - "traefik.udp.routers.wireguard.service=wireguard"
      - "traefik.udp.services.wireguard.loadbalancer.server.port=51820"
      - "traefik.docker.network=traefik_network"
    ports:
      - "51820:51820/udp"
    networks:
      traefik_network:
      private_network:
        ipv4_address: 10.2.0.3

  prometheus-wireguard-exporter:
    depends_on: [wireguard]
    network_mode: host
    hostname: wg_metrics
    restart: unless-stopped
    command: -a true -v true -n /etc/wireguard/wg0.conf
    image: mindflavor/prometheus-wireguard-exporter
    volumes:
      - "${PWD}/wireguard/wg_confs/wg0.conf:/etc/wireguard/wg0.conf:ro"
    cap_add:
      - NET_ADMIN

  adguard:
    depends_on: [unbound]
    image: adguard/adguardhome
    restart: unless-stopped
    hostname: adguard
    volumes:
      - "${PWD}/adguard/opt-adguard-work:/opt/adguardhome/work"
      - "${PWD}/adguard/opt-adguard-conf:/opt/adguardhome/conf"
    networks:
      private_network:
        ipv4_address: 10.2.0.100

When I call the metrics endpoint I get this:

curl localhost:9586/metrics
# HELP wireguard_sent_bytes_total Bytes sent to the peer
# TYPE wireguard_sent_bytes_total counter

# HELP wireguard_received_bytes_total Bytes received from the peer
# TYPE wireguard_received_bytes_total counter

# HELP wireguard_latest_handshake_seconds UNIX timestamp seconds of the last handshake
# TYPE wireguard_latest_handshake_seconds gauge

But when I run the wg show all dump command in the wireguard container it correctly shows the peer information.

wg0     HIDDEN    HIDDEN    51820   off
wg0     HIDDEN    HIDDEN    (none)  10.6.0.2/32     0       0       0       off
wg0     HIDDEN    HIDDEN    (none)  10.6.0.3/32     0       0       0       off
wg0     HIDDEN    HIDDEN    (none)  10.6.0.4/32     0       0       0       off
wg0     HIDDEN    HIDDEN    HIDDEN_IP:51820      10.6.0.5/32 1698008848      6724    68012   off

Any idea what may be happening?

@orzaez
Copy link

orzaez commented Oct 27, 2023

the same thing happens to me, i dont understando why shows just 3 types of metrics...

@JeroenW-priv
Copy link

Samething here. " wg show all dump" shows the needed info in the WG container. The wireguard exporter show the peer info being read (verbose mode) but no metrics are displayed.
Verbose output:
[2023-11-16T19:40:13Z TRACE prometheus_wireguard_exporter] wg show all dump stdout ==
[2023-11-16T19:40:13Z TRACE prometheus_wireguard_exporter] wg show all dump stderr ==
[2023-11-16T19:40:13Z DEBUG prometheus_wireguard_exporter::wireguard] WireGuard::try_from() called
[2023-11-16T19:40:13Z TRACE prometheus_wireguard_exporter::wireguard] WireGuard { interfaces: {} }
[2023-11-16T19:40:13Z DEBUG prometheus_wireguard_exporter::wireguard] WireGuard::render_with_names(self == WireGuard { interfaces: {} }, pehm == Some({"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=": PeerEntry { public_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=", allowed_ips: "10.252.1.1/32", friendly_description: None }, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=": PeerEntry { public_key: "fxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", allowed_ips: "10.252.1.2/32", friendly_description: None }}), options == Options { verbose: true, prepend_sudo: false, separate_allowed_ips: false, extract_names_config_files: Some(["/wireguard/config/wg0.conf"]), interfaces: None, export_remote_ip_and_port: false, export_latest_handshake_delay: false } called

@GeoffreyCoulaud
Copy link

Same setup and issue here

@satangua
Copy link

Hello, someone find a solution ?

@bc185174
Copy link

It'll be prepend_sudo: false. Found that without -a true no metrics are produced. #86

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

6 participants