2023-06-02 00:18:22 +03:00
|
|
|
{ config, cluster, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (cluster.config) links vars;
|
2024-07-08 21:19:45 +03:00
|
|
|
inherit (cluster.config.services.patroni) secrets;
|
2023-06-02 00:18:22 +03:00
|
|
|
|
|
|
|
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;
|
2023-06-02 00:18:22 +03:00
|
|
|
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"
|
2023-06-02 00:18:22 +03:00
|
|
|
];
|
|
|
|
autodiscover_databases = true;
|
|
|
|
};
|
|
|
|
credentials = {
|
2024-07-08 21:19:45 +03:00
|
|
|
PG_METRICS_DB_PASSWORD = secrets.metricsCredentials.path;
|
2023-06-02 00:18:22 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|