Add postgres exporter

This commit is contained in:
Ilya K 2024-07-05 15:51:26 +03:00
parent 7efe145ad4
commit 2487eac4e4
3 changed files with 7032 additions and 0 deletions

View file

@ -10,6 +10,7 @@ in
imports = [ imports = [
./baseline.nix ./baseline.nix
./nginx.nix ./nginx.nix
./postgres.nix
]; ];
options.bagel = { options.bagel = {

View file

@ -0,0 +1,31 @@
{
config,
lib,
...
}:
let
cfg = config.bagel.monitoring.exporters.postgres;
inherit (lib) mkEnableOption mkIf;
in
{
options.bagel.monitoring.exporters.postgres.enable = (mkEnableOption "Postgres exporter") // { default = config.services.postgresql.enable; };
config = mkIf cfg.enable {
services.prometheus.exporters.postgres = {
enable = true;
port = 9104;
runAsLocalSuperUser = true;
extraFlags = [
"--collector.long_running_transactions"
"--collector.stat_activity_autovacuum"
"--collector.stat_statements"
];
};
services.postgresql.settings.shared_preload_libraries = "pg_stat_statements";
bagel.meta.monitoring.exporters = [
{ port = 9104; }
];
};
}

File diff suppressed because it is too large Load diff