summary refs log tree commit diff
path: root/nixos/tests/prometheus-exporters.nix
diff options
context:
space:
mode:
author1000101 <b1000101@pm.me>2023-06-30 19:03:12 +0200
committer1000101 <b1000101@pm.me>2023-10-07 11:44:40 +0200
commit3b094812b1c00da15129b629fe4a2fc8159d687d (patch)
tree2dcb5776b6b638738f4459dd752cf773bd9a5cab /nixos/tests/prometheus-exporters.nix
parentf04ffc8a8c8fd05c9ec962178aa0cd7f3bfb3f7b (diff)
downloadnixpkgs-3b094812b1c00da15129b629fe4a2fc8159d687d.tar
nixpkgs-3b094812b1c00da15129b629fe4a2fc8159d687d.tar.gz
nixpkgs-3b094812b1c00da15129b629fe4a2fc8159d687d.tar.bz2
nixpkgs-3b094812b1c00da15129b629fe4a2fc8159d687d.tar.lz
nixpkgs-3b094812b1c00da15129b629fe4a2fc8159d687d.tar.xz
nixpkgs-3b094812b1c00da15129b629fe4a2fc8159d687d.tar.zst
nixpkgs-3b094812b1c00da15129b629fe4a2fc8159d687d.zip
prometheus-pgbouncer-exporter: init at 0.7.0
Diffstat (limited to 'nixos/tests/prometheus-exporters.nix')
-rw-r--r--nixos/tests/prometheus-exporters.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix
index 7db7fdf13eb..8369d6a497a 100644
--- a/nixos/tests/prometheus-exporters.nix
+++ b/nixos/tests/prometheus-exporters.nix
@@ -966,6 +966,36 @@ let
       '';
     };
 
+    pgbouncer = {
+      exporterConfig = {
+        enable = true;
+        connectionString = "postgres://admin:@localhost:6432/pgbouncer?sslmode=disable";
+      };
+
+      metricProvider = {
+        services.postgresql.enable = true;
+        services.pgbouncer = {
+          # https://github.com/prometheus-community/pgbouncer_exporter#pgbouncer-configuration
+          ignoreStartupParameters = "extra_float_digits";
+          enable = true;
+          listenAddress = "*";
+          databases = { postgres = "host=/run/postgresql/ port=5432 auth_user=postgres dbname=postgres"; };
+          authType = "any";
+          maxClientConn = 99;
+        };
+      };
+      exporterTest = ''
+        wait_for_unit("postgresql.service")
+        wait_for_unit("pgbouncer.service")
+        wait_for_unit("prometheus-pgbouncer-exporter.service")
+        wait_for_open_port(9127)
+        succeed("curl -sSf http://localhost:9127/metrics | grep 'pgbouncer_up 1'")
+        succeed(
+            "curl -sSf http://localhost:9127/metrics | grep 'pgbouncer_config_max_client_connections 99'"
+        )
+      '';
+    };
+
     php-fpm = {
       nodeName = "php_fpm";
       exporterConfig = {