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:23:49 +0200
committerRaphael Megzari <raphael@megzari.com>2021-06-06 08:17:25 +0900
commit5e5a3c39edfbb3022c2c8cdffd6f291471437481 (patch)
treef2b737baa40e4d928f69289ef0f292f282338979 /nixos/tests/prometheus-exporters.nix
parent0d70bbcda446223255fdd0218301e71cf5b9bbdc (diff)
nixos/prometheus: add process exporter
Diffstat (limited to 'nixos/tests/prometheus-exporters.nix')
-rw-r--r--nixos/tests/prometheus-exporters.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix
index e3bfff218adb0..d13058dff4c30 100644
--- a/nixos/tests/prometheus-exporters.nix
+++ b/nixos/tests/prometheus-exporters.nix
@@ -864,6 +864,25 @@ let
       '';
     };
 
+    process = {
+      exporterConfig = {
+        enable = true;
+        settings.process_names = [
+          # Remove nix store path from process name
+          { name = "{{.Matches.Wrapped}} {{ .Matches.Args }}"; cmdline = [ "^/nix/store[^ ]*/(?P<Wrapped>[^ /]*) (?P<Args>.*)" ]; }
+        ];
+      };
+      exporterTest = ''
+        wait_for_unit("prometheus-process-exporter.service")
+        wait_for_open_port(9256)
+        wait_until_succeeds(
+            "curl -sSf localhost:9256/metrics | grep -q '{}'".format(
+                'namedprocess_namegroup_cpu_seconds_total{groupname="process-exporter '
+            )
+        )
+      '';
+    };
+
     py-air-control = {
       nodeName = "py_air_control";
       exporterConfig = {