depot/cluster/services/patroni/metrics.nix

25 lines
659 B
Nix
Raw Permalink Normal View History

{ config, cluster, ... }:
let
inherit (cluster.config) links vars;
inherit (cluster.config.services.patroni) secrets;
getMeshIp = name: vars.mesh.${name}.meshIp;
in
{
services.grafana-agent = {
settings.integrations.postgres_exporter = {
enabled = true;
2023-08-31 01:55:45 +03:00
instance = config.networking.hostName;
data_source_names = [
2023-08-31 01:55:45 +03:00
"postgresql://metrics:\${PG_METRICS_DB_PASSWORD}@${getMeshIp config.networking.hostName}:${links.patroni-pg-internal.portStr}/postgres?sslmode=disable"
];
autodiscover_databases = true;
};
credentials = {
PG_METRICS_DB_PASSWORD = secrets.metricsCredentials.path;
};
};
}