forked from the-distro/infra
31 lines
752 B
Nix
31 lines
752 B
Nix
|
{
|
||
|
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; }
|
||
|
];
|
||
|
};
|
||
|
}
|