Fix statuses

This commit is contained in:
Henry Hiles 2025-10-30 17:23:06 -04:00
commit 3185180f10
No known key found for this signature in database

View file

@ -2,31 +2,30 @@
services: services:
pkgs.writers.writeJSON "status.json" { pkgs.writers.writeJSON "status.json" {
title = "Service Status"; title = "Service Status";
panels = map ( panels = lib.imap0 (
index:
{ name, service }: { name, service }:
{ {
title = name;
type = "stat";
gridPos = rec {
h = 3;
w = 4;
x = index * w;
y = index * h;
};
datasource = { datasource = {
type = "prometheus"; type = "prometheus";
uid = "prometheus"; uid = "prometheus";
}; };
fieldConfig = { fieldConfig = {
defaults = { defaults = {
color = { color.mode = "thresholds";
mode = "thresholds";
};
mappings = [ mappings = [
{ {
options = { options = {
"0" = { "0".text = "Failed";
color = "red"; "1".text = "Running";
index = 1;
text = "Failed";
};
"1" = {
color = "green";
index = 0;
text = "Running";
};
}; };
type = "value"; type = "value";
} }
@ -52,8 +51,6 @@ pkgs.writers.writeJSON "status.json" {
expr = "node_systemd_unit_state{name=\"${service}\",state=\"active\"}"; expr = "node_systemd_unit_state{name=\"${service}\",state=\"active\"}";
} }
]; ];
title = name;
type = "stat";
} }
) services; ) services;
} }