Compare commits

..

1 Commits

Author SHA1 Message Date
Vegard Bieker Matthey be87d98060 prometheus for dibbler 2026-06-08 10:54:03 +02:00
2 changed files with 11 additions and 6 deletions
@@ -80,12 +80,17 @@ in
LoadCredential = "postgresql_dibbler_password:${
config.sops.secrets."config/postgresql_dibbler_password".path
}";
ExecStartPre = ''/bin/sh -c '${lib.getExe' pkgs.coreutils "cat"} ${configFile} | ${lib.getExe' pkgs.jq "jq"} -c \".jobs[0].connections[0]=\\\"postgres://pvv_vv:$(${lib.getExe' pkgs.coreutils "cat"} %d/postgresql_dibbler_password)@postgres.pvv.ntnu.no\\\"\" > /run/prometheus-sql-exporter/config.yaml' '';
ExecStart = lib.mkForce ''
${pkgs.prometheus-sql-exporter}/bin/sql_exporter \
-web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
-config.file /run/prometheus-sql-exporter/config.yaml \
${lib.concatStringsSep " \\\n " cfg.extraFlags}
ExecStartPre = ''
|${lib.getExe pkgs.jq} \
--null-input \
--compact-output \
--slurpfile config '${configFile}' \
--rawfile pw '%d/postgresql_dibbler_password' \
--from-file '${pkgs.writeText "prometheus-sql-exec-start-jq-filter" ''
("postgres://pvv_vv:\($pw | gsub("\n"; ""))@postgres.pvv.ntnu.no") as $pg_uri
| $config[0]
| .jobs[0].connections[0] = $pg_uri
''}' > /run/prometheus-sql-exporter/config.yaml
'';
};
}
View File