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:${ LoadCredential = "postgresql_dibbler_password:${
config.sops.secrets."config/postgresql_dibbler_password".path 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' ''; ExecStartPre = ''
ExecStart = lib.mkForce '' |${lib.getExe pkgs.jq} \
${pkgs.prometheus-sql-exporter}/bin/sql_exporter \ --null-input \
-web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ --compact-output \
-config.file /run/prometheus-sql-exporter/config.yaml \ --slurpfile config '${configFile}' \
${lib.concatStringsSep " \\\n " cfg.extraFlags} --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