From ed7d2aa72780daeb60de593d4f159b87e1f69cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Mon, 9 Feb 2026 15:58:28 +0100 Subject: [PATCH] grafana: add deployment metrics to nixos-fleet dashboard Co-Authored-By: Claude Opus 4.5 --- services/grafana/dashboards/nixos-fleet.json | 74 ++++++++++++++++++-- 1 file changed, 69 insertions(+), 5 deletions(-) diff --git a/services/grafana/dashboards/nixos-fleet.json b/services/grafana/dashboards/nixos-fleet.json index 5a7b61c..733bf39 100644 --- a/services/grafana/dashboards/nixos-fleet.json +++ b/services/grafana/dashboards/nixos-fleet.json @@ -29,7 +29,7 @@ "id": 1, "title": "Hosts Behind Remote", "type": "stat", - "gridPos": {"h": 4, "w": 6, "x": 0, "y": 0}, + "gridPos": {"h": 4, "w": 4, "x": 0, "y": 0}, "datasource": {"type": "prometheus", "uid": "prometheus"}, "targets": [ { @@ -63,7 +63,7 @@ "id": 2, "title": "Hosts Needing Reboot", "type": "stat", - "gridPos": {"h": 4, "w": 6, "x": 6, "y": 0}, + "gridPos": {"h": 4, "w": 4, "x": 4, "y": 0}, "datasource": {"type": "prometheus", "uid": "prometheus"}, "targets": [ { @@ -97,7 +97,7 @@ "id": 3, "title": "Total Hosts", "type": "stat", - "gridPos": {"h": 4, "w": 4, "x": 12, "y": 0}, + "gridPos": {"h": 4, "w": 3, "x": 8, "y": 0}, "datasource": {"type": "prometheus", "uid": "prometheus"}, "targets": [ { @@ -124,7 +124,7 @@ "id": 4, "title": "Nixpkgs Age", "type": "stat", - "gridPos": {"h": 4, "w": 4, "x": 16, "y": 0}, + "gridPos": {"h": 4, "w": 3, "x": 11, "y": 0}, "datasource": {"type": "prometheus", "uid": "prometheus"}, "targets": [ { @@ -158,7 +158,7 @@ "id": 5, "title": "Hosts Up-to-date", "type": "stat", - "gridPos": {"h": 4, "w": 4, "x": 20, "y": 0}, + "gridPos": {"h": 4, "w": 3, "x": 14, "y": 0}, "datasource": {"type": "prometheus", "uid": "prometheus"}, "targets": [ { @@ -182,6 +182,70 @@ "graphMode": "none" } }, + { + "id": 13, + "title": "Deployments (24h)", + "type": "stat", + "gridPos": {"h": 4, "w": 3, "x": 17, "y": 0}, + "datasource": {"type": "prometheus", "uid": "prometheus"}, + "targets": [ + { + "expr": "sum(increase(homelab_deploy_deployments_total{status=\"completed\"}[24h]))", + "legendFormat": "Deployments", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [{"color": "blue", "value": null}] + }, + "noValue": "0", + "decimals": 0 + } + }, + "options": { + "reduceOptions": {"calcs": ["lastNotNull"]}, + "colorMode": "value", + "graphMode": "none" + }, + "description": "Total successful deployments in the last 24 hours" + }, + { + "id": 14, + "title": "Avg Deploy Time", + "type": "stat", + "gridPos": {"h": 4, "w": 4, "x": 20, "y": 0}, + "datasource": {"type": "prometheus", "uid": "prometheus"}, + "targets": [ + { + "expr": "sum(increase(homelab_deploy_deployment_duration_seconds_sum{success=\"true\"}[24h])) / sum(increase(homelab_deploy_deployment_duration_seconds_count{success=\"true\"}[24h]))", + "legendFormat": "Avg Time", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "s", + "thresholds": { + "mode": "absolute", + "steps": [ + {"color": "green", "value": null}, + {"color": "yellow", "value": 30}, + {"color": "red", "value": 60} + ] + }, + "noValue": "-" + } + }, + "options": { + "reduceOptions": {"calcs": ["lastNotNull"]}, + "colorMode": "value", + "graphMode": "none" + }, + "description": "Average deployment duration over the last 24 hours (yellow >30s, red >60s)" + }, { "id": 6, "title": "Fleet Status",