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)" // {
default = true;
};
port = mkOption {
type = types.port;
default = 9002;
description = ''
Port to listen on.
ports = mkOption {
type = types.attrsOf types.port;
default = {
node = 9002;
cgroup = 9003;
};
description = lib.mdDoc ''
Ports to listen on for each exporter.
'';
};
};
@ -48,15 +52,17 @@ in
"processes"
"systemd"
];
inherit (cfg) port;
port = cfg.ports.node;
listenAddress = "0.0.0.0";
};
cgroup = {
enable = true;
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;
};
}