From e80b0b2b228fb89efdc92c4abb1695f42925b025 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 8 Aug 2019 21:47:19 +0200 Subject: [PATCH 1/2] prometheus-wireguard-exporter: 3.0.0 -> 3.0.1 https://github.com/MindFlavor/prometheus_wireguard_exporter/releases/tag/3.0.1 --- pkgs/servers/monitoring/prometheus/wireguard-exporter.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/monitoring/prometheus/wireguard-exporter.nix b/pkgs/servers/monitoring/prometheus/wireguard-exporter.nix index 52620478339..1b4ffd61ec7 100644 --- a/pkgs/servers/monitoring/prometheus/wireguard-exporter.nix +++ b/pkgs/servers/monitoring/prometheus/wireguard-exporter.nix @@ -2,13 +2,13 @@ rustPlatform.buildRustPackage rec { pname = "wireguard-exporter"; - version = "3.0.0"; + version = "3.0.1"; src = fetchFromGitHub { owner = "MindFlavor"; repo = "prometheus_wireguard_exporter"; rev = version; - sha256 = "1vgwsg81xcxh7pcdc667mfviwwpzsm4lpllykf78vfahi9qmwffn"; + sha256 = "0wfv54ny557mjajjdf0lyq5sbf9m7y50ggm7s2v30c639i0swyrc"; }; cargoSha256 = "06s9194lvwd7lynxnsrjfbjfj87ngvjbqjhx3idf7d1w9mgi4ysw"; From 41b9c5f1da020762f559e8a11c79fa7604d6c058 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 8 Aug 2019 21:54:49 +0200 Subject: [PATCH 2/2] nixos/prometheus-wireguard-exporter: add support for `-r` switch With this switch activated, the exporter also exposes the remote IP of each active WireGuard peer. --- .../monitoring/prometheus/exporters/wireguard.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix b/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix index aee7cba2638..8ae2c927b58 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix @@ -34,6 +34,14 @@ in { allowed_ip_1 and so on. ''; }; + + withRemoteIp = mkOption { + type = types.bool; + default = false; + description = '' + Whether or not the remote IP of a WireGuard peer should be exposed via prometheus. + ''; + }; }; serviceOpts = { path = [ pkgs.wireguard-tools ]; @@ -45,6 +53,7 @@ in { -p ${toString cfg.port} \ ${optionalString cfg.verbose "-v"} \ ${optionalString cfg.singleSubnetPerField "-s"} \ + ${optionalString cfg.withRemoteIp "-r"} \ ${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"} ''; };