From 0027489052604f2dd0fb04b2433c853e7d0e001e Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 31 Mar 2026 13:20:07 -0400 Subject: [PATCH] grafana: smooth power draw --- services/monitoring.nix | 51 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/services/monitoring.nix b/services/monitoring.nix index 8dc9ed9..a87c578 100644 --- a/services/monitoring.nix +++ b/services/monitoring.nix @@ -74,6 +74,12 @@ let legendFormat = "Power (W)"; refId = "A"; } + { + datasource = promDs; + expr = "avg_over_time((apcupsd_ups_load_percent / 100 * apcupsd_nominal_power_watts)[1h:])"; + legendFormat = "1h average (W)"; + refId = "B"; + } ]; fieldConfig = { defaults = { @@ -85,7 +91,50 @@ let spanNulls = true; }; }; - overrides = [ ]; + overrides = [ + { + matcher = { + id = "byFrameRefID"; + options = "A"; + }; + properties = [ + { + id = "custom.lineStyle"; + value = { + fill = "dot"; + }; + } + { + id = "custom.fillOpacity"; + value = 10; + } + { + id = "custom.lineWidth"; + value = 1; + } + { + id = "custom.pointSize"; + value = 1; + } + ]; + } + { + matcher = { + id = "byFrameRefID"; + options = "B"; + }; + properties = [ + { + id = "custom.lineWidth"; + value = 4; + } + { + id = "custom.fillOpacity"; + value = 0; + } + ]; + } + ]; }; } {