From dcdc41b944aac6a5bcb4b3130c03625c18fd0741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Mon, 29 Jul 2024 11:37:17 +0200 Subject: [PATCH] hosts/kazuki/prometheus: add target labels and set grafana domain --- hosts/kazuki/prometheus.nix | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/hosts/kazuki/prometheus.nix b/hosts/kazuki/prometheus.nix index 17d798b..79be7cb 100644 --- a/hosts/kazuki/prometheus.nix +++ b/hosts/kazuki/prometheus.nix @@ -19,15 +19,29 @@ _: nixos: (nodeExporter nixos).enable ) inputs.settei.nixosConfigurations; in - lib.mapAttrsToList (name: nixos: { - job_name = "${name}-node"; - static_configs = [ { targets = [ "${name}:${toString (nodeExporter nixos).port}" ]; } ]; - }) configurations; + lib.mapAttrsToList ( + name: nixos: + let + target = "${name}:${toString (nodeExporter nixos).port}"; + in + { + job_name = "${name}-node"; + static_configs = [ + { + targets = [ target ]; + labels.${name} = target; + } + ]; + } + ) configurations; }; services.grafana = { enable = true; - settings.server.http_port = 3030; + settings.server = { + http_port = 3030; + root_url = "https://monitor.rab.lol"; + }; }; services.nginx = {