From 23d255bd390397176d4401e57a1d618b971712be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 15 Jan 2022 21:50:42 +0100 Subject: [PATCH] Add postgres_exporter --- config/services/postgres.nix | 6 +++++- config/services/prometheus.nix | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/config/services/postgres.nix b/config/services/postgres.nix index 6485d97f..f85683b1 100644 --- a/config/services/postgres.nix +++ b/config/services/postgres.nix @@ -1,7 +1,11 @@ -{ lib, ... }: { +{ config, lib, ... }: { services.postgresql = { enable = true; enableTCPIP = true; authentication = "host all all fd0d:a262:1fa6:e621::/64 md5"; }; + services.prometheus.exporters.postgres = { + enable = true; + listenAddress = (import ../../utils/getInternalIP.nix config).listenIP; + }; } diff --git a/config/services/prometheus.nix b/config/services/prometheus.nix index 7361f47f..75d2878a 100644 --- a/config/services/prometheus.nix +++ b/config/services/prometheus.nix @@ -19,6 +19,14 @@ ]; }]; } + { + job_name = "postgres_exporter"; + static_configs = [{ + targets = [ + "${config.services.prometheus.exporters.postgres.listenAddress}:${toString config.services.prometheus.exporters.postgres.port}" + ]; + }]; + } ]; }; }