about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorNudelsalat <nudelsalat@clouz.de>2023-11-07 13:34:15 +0100
committerNudelsalat <nudelsalat@clouz.de>2023-12-24 18:11:31 +0100
commitf3fb9a9134efb8f1328fa78523c6bc75af649c7a (patch)
treed40e46782544682659405ea268747cec11755bb8 /nixos/tests
parent5d85f0eee8417f340424e20345e8ccb86929a73f (diff)
downloadnixlib-f3fb9a9134efb8f1328fa78523c6bc75af649c7a.tar
nixlib-f3fb9a9134efb8f1328fa78523c6bc75af649c7a.tar.gz
nixlib-f3fb9a9134efb8f1328fa78523c6bc75af649c7a.tar.bz2
nixlib-f3fb9a9134efb8f1328fa78523c6bc75af649c7a.tar.lz
nixlib-f3fb9a9134efb8f1328fa78523c6bc75af649c7a.tar.xz
nixlib-f3fb9a9134efb8f1328fa78523c6bc75af649c7a.tar.zst
nixlib-f3fb9a9134efb8f1328fa78523c6bc75af649c7a.zip
nixos/tests/prometheus-ping-exporter: init
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/prometheus-exporters.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix
index 14c0cc0e1d85..2b08ca8f5351 100644
--- a/nixos/tests/prometheus-exporters.nix
+++ b/nixos/tests/prometheus-exporters.nix
@@ -1053,6 +1053,50 @@ let
       '';
     };
 
+    ping = {
+      exporterConfig = {
+        enable = true;
+
+        settings = {
+          targets = [ {
+            "localhost" = {
+              alias = "local machine";
+              env = "prod";
+              type = "domain";
+            };
+          } {
+            "127.0.0.1" = {
+              alias = "local machine";
+              type = "v4";
+            };
+          } {
+            "::1" = {
+              alias = "local machine";
+              type = "v6";
+            };
+          } {
+            "google.com" = {};
+          } ];
+          dns = {};
+          ping = {
+            interval = "2s";
+            timeout = "3s";
+            history-size = 42;
+            payload-size = 56;
+          };
+          log = {
+            level = "warn";
+          };
+        };
+      };
+
+      exporterTest = ''
+        wait_for_unit("prometheus-ping-exporter.service")
+        wait_for_open_port(9427)
+        succeed("curl -sSf http://localhost:9427/metrics | grep 'ping_up{.*} 1'")
+      '';
+    };
+
     postfix = {
       exporterConfig = {
         enable = true;