about summary refs log tree commit diff
path: root/nixos/tests/prometheus-exporters.nix
diff options
context:
space:
mode:
authorFlakebi <flakebi@t-online.de>2021-05-18 22:53:10 +0200
committerFlakebi <flakebi@t-online.de>2021-06-06 22:42:46 +0200
commit3bcf4e31ef70e2d6ec3fd387c174673aa01ef736 (patch)
treedc0f85013945e675c894f7306c4ea3ee12ca10f9 /nixos/tests/prometheus-exporters.nix
parentd83bd16a2eab64e3e1b67cd5689807ec844450ba (diff)
nixos/prometheus: add script exporter
Diffstat (limited to 'nixos/tests/prometheus-exporters.nix')
-rw-r--r--nixos/tests/prometheus-exporters.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix
index e3bfff218adb0..defec2b8376d7 100644
--- a/nixos/tests/prometheus-exporters.nix
+++ b/nixos/tests/prometheus-exporters.nix
@@ -945,6 +945,24 @@ let
       '';
     };
 
+    script = {
+      exporterConfig = {
+        enable = true;
+        settings.scripts = [
+          { name = "success"; script = "sleep 1"; }
+        ];
+      };
+      exporterTest = ''
+        wait_for_unit("prometheus-script-exporter.service")
+        wait_for_open_port(9172)
+        wait_until_succeeds(
+            "curl -sSf 'localhost:9172/probe?name=success' | grep -q '{}'".format(
+                'script_success{script="success"} 1'
+            )
+        )
+      '';
+    };
+
     smokeping = {
       exporterConfig = {
         enable = true;