fix(modules/nixos/dgn-node-monitoring): listen and fix the cgroup port

Otherwise, we cannot scrape that specific port.

Signed-off-by: Ryan Lahfa <ryan@dgnum.eu>
This commit is contained in:
Ryan Lahfa 2024-12-15 20:45:34 +01:00
parent a1f17d1850
commit bb7f538110

View file

@ -26,11 +26,15 @@ in
enable = mkEnableOption "DGNum nodes monitoring (needs a valid netbird tunnel)" // { enable = mkEnableOption "DGNum nodes monitoring (needs a valid netbird tunnel)" // {
default = true; default = true;
}; };
port = mkOption {
type = types.port; ports = mkOption {
default = 9002; type = types.attrsOf types.port;
description = '' default = {
Port to listen on. node = 9002;
cgroup = 9003;
};
description = lib.mdDoc ''
Ports to listen on for each exporter.
''; '';
}; };
}; };
@ -48,15 +52,17 @@ in
"processes" "processes"
"systemd" "systemd"
]; ];
inherit (cfg) port; port = cfg.ports.node;
listenAddress = "0.0.0.0"; listenAddress = "0.0.0.0";
}; };
cgroup = { cgroup = {
enable = true; enable = true;
package = pkgs.callPackage "${sources.cgroup-exporter}/nix/package.nix" { }; package = pkgs.callPackage "${sources.cgroup-exporter}/nix/package.nix" { };
listenAddress = "0.0.0.0";
port = cfg.ports.cgroup;
}; };
}; };
}; };
networking.firewall.interfaces.wt0.allowedTCPPorts = [ cfg.port ]; networking.firewall.interfaces.wt0.allowedTCPPorts = builtins.attrValues cfg.ports;
}; };
} }