about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2019-07-21 20:19:22 +0000
committerGitHub <noreply@github.com>2019-07-21 20:19:22 +0000
commitbc418837d540822b4babece9fddf536c441fe1b1 (patch)
tree8c56c368c52f448863bf63b1fa154630db5b98ae /nixos
parente21cb9933be2dec8990b29ed388590067798dad6 (diff)
parent7095bdf9889cc0e412ab6d2270d3c671c39fe70a (diff)
downloadnixlib-bc418837d540822b4babece9fddf536c441fe1b1.tar
nixlib-bc418837d540822b4babece9fddf536c441fe1b1.tar.gz
nixlib-bc418837d540822b4babece9fddf536c441fe1b1.tar.bz2
nixlib-bc418837d540822b4babece9fddf536c441fe1b1.tar.lz
nixlib-bc418837d540822b4babece9fddf536c441fe1b1.tar.xz
nixlib-bc418837d540822b4babece9fddf536c441fe1b1.tar.zst
nixlib-bc418837d540822b4babece9fddf536c441fe1b1.zip
Merge pull request #65225 from Ma27/bump-prometheus-wireguard-exporter
prometheus-wireguard-exporter: 2.0.1 -> 3.0.0
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix12
-rw-r--r--nixos/tests/prometheus-exporters.nix3
2 files changed, 14 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix b/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix
index c5b84e574b8d..eae7a61297d1 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix
@@ -23,12 +23,24 @@ in {
         to set the peers up.
       '';
     };
+
+    singleSubnetPerField = mkOption {
+      type = types.bool;
+      default = false;
+      description = ''
+        By default, all allowed IPs and subnets are comma-separated in the
+        <literal>allowed_ips</literal> field. With this option enabled,
+        a single IP and subnet will be listed in fields like <literal>allowed_ip_0</literal>,
+        <literal>allowed_ip_1</literal> and so on.
+      '';
+    };
   };
   serviceOpts = {
     script = ''
       ${pkgs.prometheus-wireguard-exporter}/bin/prometheus_wireguard_exporter \
         -p ${toString cfg.port} \
         ${optionalString cfg.verbose "-v"} \
+        ${optionalString cfg.singleSubnetPerField "-s"} \
         ${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"}
     '';
 
diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix
index 90c7c9701f60..9a85501d15f8 100644
--- a/nixos/tests/prometheus-exporters.nix
+++ b/nixos/tests/prometheus-exporters.nix
@@ -331,11 +331,12 @@ let
             inherit (snakeoil.peer1) publicKey;
           };
         };
+        systemd.services.prometheus-wireguard-exporter.after = [ "wireguard-wg0.service" ];
       };
       exporterTest = ''
         waitForUnit("prometheus-wireguard-exporter.service");
         waitForOpenPort(9586);
-        succeed("curl -sSf http://localhost:9586/metrics | grep '${snakeoil.peer1.publicKey}'");
+        waitUntilSucceeds("curl -sSf http://localhost:9586/metrics | grep '${snakeoil.peer1.publicKey}'");
       '';
     };
   };