From bee402fecc5afa7c8144a22a80d1192b68d9f025 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Mon, 21 Oct 2024 14:33:18 +0200 Subject: [PATCH] fix: ensure that pg_stat_statements is always created as an ext Otherwise, we will have issues with this exporter. Signed-off-by: Raito Bezarius --- services/monitoring/exporters/postgres.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/monitoring/exporters/postgres.nix b/services/monitoring/exporters/postgres.nix index c6a9469..ee16b98 100644 --- a/services/monitoring/exporters/postgres.nix +++ b/services/monitoring/exporters/postgres.nix @@ -23,7 +23,10 @@ in }; services.postgresql.settings.shared_preload_libraries = "pg_stat_statements"; + systemd.services.postgresql.postStart = lib.mkAfter '' + ${config.services.postgresql.package}/bin/psql -U postgres -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;"; + ''; bagel.monitoring.grafana-agent.exporters.postgres.port = 9104; }; -} \ No newline at end of file +}