Compare commits

..

1 Commits

Author SHA1 Message Date
Vegard Bieker Matthey 864cdab35e prometheus for dibbler 2026-06-07 17:54:41 +02:00
2 changed files with 6 additions and 11 deletions
@@ -80,17 +80,12 @@ 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 = '' 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' '';
|${lib.getExe pkgs.jq} \ ExecStart = lib.mkForce ''
--null-input \ ${pkgs.prometheus-sql-exporter}/bin/sql_exporter \
--compact-output \ -web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
--slurpfile config '${configFile}' \ -config.file /run/prometheus-sql-exporter/config.yaml \
--rawfile pw '%d/postgresql_dibbler_password' \ ${lib.concatStringsSep " \\\n " cfg.extraFlags}
--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