From 3185180f1059a15b1220a10641b839c3e78f77dd Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 30 Oct 2025 17:23:06 -0400 Subject: [PATCH] Fix statuses --- lib/status.nix | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/lib/status.nix b/lib/status.nix index 7bb4e6c..3f725e7 100644 --- a/lib/status.nix +++ b/lib/status.nix @@ -2,31 +2,30 @@ services: pkgs.writers.writeJSON "status.json" { title = "Service Status"; - panels = map ( + panels = lib.imap0 ( + index: { name, service }: { + title = name; + type = "stat"; + gridPos = rec { + h = 3; + w = 4; + x = index * w; + y = index * h; + }; datasource = { type = "prometheus"; uid = "prometheus"; }; fieldConfig = { defaults = { - color = { - mode = "thresholds"; - }; + color.mode = "thresholds"; mappings = [ { options = { - "0" = { - color = "red"; - index = 1; - text = "Failed"; - }; - "1" = { - color = "green"; - index = 0; - text = "Running"; - }; + "0".text = "Failed"; + "1".text = "Running"; }; type = "value"; } @@ -52,8 +51,6 @@ pkgs.writers.writeJSON "status.json" { expr = "node_systemd_unit_state{name=\"${service}\",state=\"active\"}"; } ]; - title = name; - type = "stat"; } ) services; }