psyhomb / wireguard-tools

Wireguard helper scripts
https://gitlab.com/psyhomb/wireguard-tools
MIT License
184 stars 25 forks source link

Grafana dashboard - multiple instances #3

Open Dan-Sun opened 2 years ago

Dan-Sun commented 2 years ago

Hey

I am currently trying out your dashboard. There is an option at the top called "Node". Is it possible to add via targets, a node_name or something to have separate nodes/instances listed?

psyhomb commented 2 years ago

Hey @Dan-Sun, thanks for reaching out. 🙂

In our production environment we use Prometheus as datasource and one of the labels we append to all our metric sets is node label and the value of that label is actually a node name (hostname), so if in your environment you use a different label name to store hostname of the wireguard server, all you have to do is to replace mentioned label directly in Grafana dashboard configuration file or via Grafana UI.

2022-09-03_13-50 2022-09-03_14-09

I hope this answers your question?

Dan-Sun commented 2 years ago

Hey!

Thanks for your reply and sorry for the late reply ;)

A bit info for our set up which is also prometheus. We have 2 server for wireguard.

prometheus.yml

  - job_name: 'wireguard'
    basic_auth:
    file_sd_configs:
      - files:
        - wireguard_targets.yml

wireguard_targets.yml

- targets: ['domain']
  labels:
     job: wireguard 
     __node__: domain
     __metrics_path__: /wireguard_exporter
     __scheme__: https

- targets: ['domain2']
  labels:
     job: wireguard 
     __node__: domain2
     __metrics_path__: /wireguard_exporter
     __scheme__: https

but this way doesn't work. Obviously :D