fix: some small fixes for prometheus

This commit is contained in:
silver 2024-06-17 20:52:03 +01:00
parent 07cb42dd65
commit 8009b7c8d1
Signed by: silver
GPG key ID: 54E2C71918E93B74

View file

@ -21,7 +21,7 @@ with lib; let
)
nodes
);
node = lib.attrsets.mapAttrsToList (key: value: "${value.config.deployment.targetHost}:${toString config.services.prometheus.exporters.node.port}") nodes;
node = lib.attrsets.mapAttrsToList (key: value: "${value.config.deployment.targetHost}:${toString value.config.services.prometheus.exporters.node.port}") nodes;
};
# clears any invalid entries
@ -37,8 +37,10 @@ in {
type = types.port;
default = 9001;
};
};
external.node = mkOption {
external = {
node = mkOption {
type = types.listOf types.str;
default = [];
description = ''
@ -46,12 +48,20 @@ in {
'';
};
};
ports = {
node = mkOption {
type = types.port;
default = 9100;
};
};
};
config = mkMerge [
{
services.prometheus.exporters.node = {
enable = true;
port = cfg.ports.node;
openFirewall = true;
# most collectors are on by default see https://github.com/prometheus/node_exporter for more options
enabledCollectors = ["systemd" "processes"];
@ -66,7 +76,7 @@ in {
job_name = "node_exporter";
static_configs = [
{
targets = filter_empty (exporters.node ++ cfg.server.external.node);
targets = filter_empty (exporters.node ++ cfg.external.node);
}
];
}