about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorWilliButz <wbutz@cyberfnord.de>2019-08-11 12:06:29 +0200
committerWilliButz <wbutz@cyberfnord.de>2019-08-12 10:53:00 +0200
commitc28ded36ef50cb80796c6bd946754abfb47ffa28 (patch)
tree2277bd0148358948b7f6821d6f11c186bee33de8 /nixos/modules/services
parentdcc12cea9f72717a6f22e5d15c65f4042512b775 (diff)
downloadnixlib-c28ded36ef50cb80796c6bd946754abfb47ffa28.tar
nixlib-c28ded36ef50cb80796c6bd946754abfb47ffa28.tar.gz
nixlib-c28ded36ef50cb80796c6bd946754abfb47ffa28.tar.bz2
nixlib-c28ded36ef50cb80796c6bd946754abfb47ffa28.tar.lz
nixlib-c28ded36ef50cb80796c6bd946754abfb47ffa28.tar.xz
nixlib-c28ded36ef50cb80796c6bd946754abfb47ffa28.tar.zst
nixlib-c28ded36ef50cb80796c6bd946754abfb47ffa28.zip
nixos/prometheus-blackbox-exporter: add config check
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/blackbox.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/blackbox.nix b/nixos/modules/services/monitoring/prometheus/exporters/blackbox.nix
index f69b389760f7..ca4366121e12 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/blackbox.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/blackbox.nix
@@ -4,6 +4,13 @@ with lib;
 
 let
   cfg = config.services.prometheus.exporters.blackbox;
+
+  checkConfig = file: pkgs.runCommand "checked-blackbox-exporter.conf" {
+    preferLocalBuild = true;
+    buildInputs = [ pkgs.buildPackages.prometheus-blackbox-exporter ]; } ''
+    ln -s ${file} $out
+    blackbox_exporter --config.check --config.file $out
+  '';
 in
 {
   port = 9115;
@@ -21,7 +28,7 @@ in
       ExecStart = ''
         ${pkgs.prometheus-blackbox-exporter}/bin/blackbox_exporter \
           --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
-          --config.file ${cfg.configFile} \
+          --config.file ${checkConfig cfg.configFile} \
           ${concatStringsSep " \\\n  " cfg.extraFlags}
       '';
       ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";