commit a39a11f9d2c569196ffc02dd78e5fd0fc2712b1e
parent 4b50d56d6fe4cf1cd42da44d03cf4c0c80dea12f
Author: Leah (ctucx) <git@ctu.cx>
Date: Tue, 6 Dec 2022 15:00:36 +0100
parent 4b50d56d6fe4cf1cd42da44d03cf4c0c80dea12f
Author: Leah (ctucx) <git@ctu.cx>
Date: Tue, 6 Dec 2022 15:00:36 +0100
machines/trabbi/prometheus: automagically add hosts that have a node-exporter enabled as a target
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/machines/trabbi/prometheus.nix b/machines/trabbi/prometheus.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ nodes, config, lib, pkgs, ... }: { @@ -28,18 +28,18 @@ scheme = "https"; metrics_path = "/node-exporter"; static_configs = [{ - targets = [ - "trabbi.ctu.cx" - "osterei.ctu.cx" - "wanderduene.ctu.cx" - "desastro.ctu.cx" - "lollo.ctu.cx" - "hector.ctu.cx" + targets = (lib.mapAttrsToList ( + name: host: lib.mkIf ( + host.config.services.prometheus.exporters.node.enable == true && + host.config.networking.hostName != "" && + host.config.networking.domain != "" + ) host.config.networking.fqdn + ) nodes) ++ [ "stasicontainer.home.ctu.cx" + "mastodon.zug.network" "luna.f2k1.de" "jules.f2k1.de" "taurus.f2k1.de" - "mastodon.zug.network" ]; }]; }