cluster/services/patroni: enable metrics

This commit is contained in:
Max Headroom 2023-06-01 23:18:22 +02:00
parent 6fb3a543b8
commit 98b2537482
4 changed files with 45 additions and 1 deletions

View file

@ -19,7 +19,10 @@
haproxy = [ "checkmate" "VEGAS" "prophet" ];
};
nixos = {
worker = ./worker.nix;
worker = [
./worker.nix
./metrics.nix
];
haproxy = ./haproxy.nix;
};
};

View file

@ -0,0 +1,25 @@
{ config, cluster, ... }:
let
inherit (cluster.config) links vars;
getMeshIp = name: vars.mesh.${name}.meshIp;
in
{
age.secrets.postgres-metrics-db-credentials.file = ./passwords/metrics.age;
services.grafana-agent = {
settings.integrations.postgres_exporter = {
enabled = true;
instance = vars.hostName;
data_source_names = [
"postgresql://metrics:\${PG_METRICS_DB_PASSWORD}@${getMeshIp vars.hostName}:${links.patroni-pg-internal.portStr}/postgres?sslmode=disable"
];
autodiscover_databases = true;
};
credentials = {
PG_METRICS_DB_PASSWORD = config.age.secrets.postgres-metrics-db-credentials.path;
};
};
}

View file

@ -0,0 +1,15 @@
age-encryption.org/v1
-> ssh-ed25519 NO562A UZDVDyrbgLGKKnssXfhpvQoKLhI/RAxys+DM4Jka4iQ
X1hNCTU8G6aatngQyq7LvkHTfbpUDPOhGzulr8Nzc4k
-> ssh-ed25519 5/zT0w gv8U5Wa08WWJNkhi0S4V8Ug7sgyPnNLBMc6jYsMU4xM
m7SGWdD/cnse3m+9KdkdobgoKcsV0wzbjwQTZu7b2T4
-> ssh-ed25519 FfIUuQ fB/7/JIl4FA8iqAI/dlUNUZuEM0vMep7wSBmpmharz4
Gt3uKzVi++lRcKodWlGgeDKE2ogk9O1JUFSlc7LxeSg
-> ssh-ed25519 d3WGuA WN8M0MQORIKi2YjyaJB4UvHopOtEbN+dpleL1ms64SM
ZbjoLTxXWGagSvcfpqVQsGhtAKUKhqc1yS9hlWFym+I
-> ssh-ed25519 YIaSKQ ij5ROzrXgYT6dTiONqflPz2+oVz9lRaE0Dcc1+A+h30
TYWRVn97qM3ocd5keHi+1IPjgARfcri57oGr2+fZTrE
-> FP.Bh-grease uS|AoN& 0cdpf
GeHSrkswVd5L7QmFWL8wHld2NmQz
--- 2iy6cb/bcbHol77a7GoPWckCKIsnnvIQbTwfKQ2+Gyw
<EFBFBD>Êd1ˆ>D¹Ñ¶gÒ%{"V¸Úúhxè‰Iº<>]M¦~µ±c¬Ûíbô#Kí4«êþïèïH îáÏê¹× ¹\`‚¾ãÃÂÿβšªÑm¡*.ÆáPô€ËF­aTÎôt#Í.*õÛ.{46HÙQ+˜M,Ÿ4¢Î=! _mù†»<E280A0>mBT“µ<E2809C>ÍD}Ýë¼YPJ­íƒ¥[Óµ(FDÕeû7œ

View file

@ -26,6 +26,7 @@ in with hosts;
"cluster/services/monitoring/secrets/grafana-db-credentials.age".publicKeys = max ++ map systemKeys [ VEGAS ];
"cluster/services/monitoring/secrets/grafana-secrets.age".publicKeys = max ++ map systemKeys [ VEGAS ];
"cluster/services/monitoring/secrets/secret-monitoring/blackbox.age".publicKeys = max ++ map systemKeys [ checkmate VEGAS prophet ];
"cluster/services/patroni/passwords/metrics.age".publicKeys = max ++ map systemKeys [ thunderskin VEGAS prophet ];
"cluster/services/patroni/passwords/replication.age".publicKeys = max ++ map systemKeys [ thunderskin VEGAS prophet ];
"cluster/services/patroni/passwords/rewind.age".publicKeys = max ++ map systemKeys [ thunderskin VEGAS prophet ];
"cluster/services/patroni/passwords/superuser.age".publicKeys = max ++ map systemKeys [ thunderskin VEGAS prophet ];