forked from the-distro/infra
Add postgres exporter
This commit is contained in:
parent
42f8ad8fa4
commit
03cb9c390c
|
@ -10,6 +10,7 @@ in
|
|||
imports = [
|
||||
./baseline.nix
|
||||
./nginx.nix
|
||||
./postgres.nix
|
||||
];
|
||||
|
||||
options.bagel = {
|
||||
|
|
31
services/monitoring/exporters/postgres.nix
Normal file
31
services/monitoring/exporters/postgres.nix
Normal 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; }
|
||||
];
|
||||
};
|
||||
}
|
7000
services/monitoring/lgtm/dashboards/postgres.json
Normal file
7000
services/monitoring/lgtm/dashboards/postgres.json
Normal file
File diff suppressed because it is too large
Load diff
3280
services/monitoring/lgtm/dashboards/postgres2.json
Normal file
3280
services/monitoring/lgtm/dashboards/postgres2.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue