From bb7f5381108e338a692802845a225d45f76fb2b8 Mon Sep 17 00:00:00 2001 From: Ryan Lahfa Date: Sun, 15 Dec 2024 20:45:34 +0100 Subject: [PATCH] fix(modules/nixos/dgn-node-monitoring): listen and fix the cgroup port Otherwise, we cannot scrape that specific port. Signed-off-by: Ryan Lahfa --- modules/nixos/dgn-node-monitoring.nix | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/nixos/dgn-node-monitoring.nix b/modules/nixos/dgn-node-monitoring.nix index 34f7087..2a8d366 100644 --- a/modules/nixos/dgn-node-monitoring.nix +++ b/modules/nixos/dgn-node-monitoring.nix @@ -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; }; }