summary refs log tree commit diff
path: root/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2019-08-08 21:54:49 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2019-08-08 21:54:49 +0200
commit41b9c5f1da020762f559e8a11c79fa7604d6c058 (patch)
tree890813cf8c4d07654a035d908b633df48e4dba12 /nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix
parente80b0b2b228fb89efdc92c4abb1695f42925b025 (diff)
downloadnixpkgs-41b9c5f1da020762f559e8a11c79fa7604d6c058.tar
nixpkgs-41b9c5f1da020762f559e8a11c79fa7604d6c058.tar.gz
nixpkgs-41b9c5f1da020762f559e8a11c79fa7604d6c058.tar.bz2
nixpkgs-41b9c5f1da020762f559e8a11c79fa7604d6c058.tar.lz
nixpkgs-41b9c5f1da020762f559e8a11c79fa7604d6c058.tar.xz
nixpkgs-41b9c5f1da020762f559e8a11c79fa7604d6c058.tar.zst
nixpkgs-41b9c5f1da020762f559e8a11c79fa7604d6c058.zip
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.
Diffstat (limited to 'nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix9
1 files changed, 9 insertions, 0 deletions
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 {
         <literal>allowed_ip_1</literal> 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}"}
       '';
     };