feat(monitoring): Enable node exporter on almost all nodes

This commit is contained in:
sinavir 2024-04-14 01:06:22 +02:00
parent 8e79b19101
commit c6fe6b5891
5 changed files with 69 additions and 1 deletions

View file

@ -1,8 +1,26 @@
{ config, ... }:
{
config,
nodes,
lib,
...
}:
let
host = "prometheus.dgnum.eu";
port = 9091;
nodeExporterConfigs = lib.flatten (
lib.mapAttrsToList (
node:
{ config, ... }:
lib.optional config.dgn-node-monitoring.enable {
targets = [ "${node}.dgnum:${builtins.toString config.dgn-node-monitoring.port}" ];
labels = {
host = node;
};
}
) nodes
);
in
{
@ -33,6 +51,10 @@ in
job_name = "prometheus";
static_configs = [ { targets = [ "localhost:9090" ]; } ];
}
{
job_name = "node_exporter";
static_configs = nodeExporterConfigs;
}
];
};