Skip to content

Commit 524bcb7

Browse files
committed
feat: ups outage
1 parent 05fe233 commit 524bcb7

File tree

1 file changed

+44
-11
lines changed

1 file changed

+44
-11
lines changed

custom_modules/monitoring.nix

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,44 @@ in
189189
graphTooltip = 0;
190190
links = [];
191191
panels = [
192+
# Row 0: Power Status Timeline
193+
{
194+
type = "state-timeline";
195+
title = "Power Outage History";
196+
description = "Shows when the UPS was on battery power (power outage) vs online (AC power)";
197+
gridPos = { h = 6; w = 24; x = 0; y = 0; };
198+
datasource = { type = "prometheus"; uid = "Prometheus"; };
199+
fieldConfig.defaults = {
200+
color.mode = "thresholds";
201+
thresholds.mode = "absolute";
202+
thresholds.steps = [
203+
{ color = "green"; value = null; }
204+
{ color = "red"; value = 1; }
205+
];
206+
mappings = [
207+
{ type = "value"; options."0" = { text = "Online (AC)"; color = "green"; }; }
208+
{ type = "value"; options."1" = { text = "On Battery"; color = "red"; }; }
209+
];
210+
custom.fillOpacity = 80;
211+
};
212+
options = {
213+
showValue = "auto";
214+
alignValue = "center";
215+
mergeValues = true;
216+
rowHeight = 0.9;
217+
legend = { displayMode = "list"; placement = "bottom"; };
218+
};
219+
targets = [{
220+
expr = ''network_ups_tools_ups_status{flag="OB"}'';
221+
legendFormat = "Power Status";
222+
refId = "A";
223+
}];
224+
}
192225
# Row 1: Status gauges
193226
{
194227
type = "gauge";
195228
title = "Battery Charge";
196-
gridPos = { h = 8; w = 6; x = 0; y = 0; };
229+
gridPos = { h = 8; w = 6; x = 0; y = 6; };
197230
datasource = { type = "prometheus"; uid = "Prometheus"; };
198231
fieldConfig.defaults = {
199232
color.mode = "thresholds";
@@ -214,7 +247,7 @@ in
214247
{
215248
type = "gauge";
216249
title = "UPS Load";
217-
gridPos = { h = 8; w = 6; x = 6; y = 0; };
250+
gridPos = { h = 8; w = 6; x = 6; y = 6; };
218251
datasource = { type = "prometheus"; uid = "Prometheus"; };
219252
fieldConfig.defaults = {
220253
color.mode = "thresholds";
@@ -235,7 +268,7 @@ in
235268
{
236269
type = "stat";
237270
title = "Runtime Remaining";
238-
gridPos = { h = 8; w = 6; x = 12; y = 0; };
271+
gridPos = { h = 8; w = 6; x = 12; y = 6; };
239272
datasource = { type = "prometheus"; uid = "Prometheus"; };
240273
fieldConfig.defaults = {
241274
color.mode = "thresholds";
@@ -254,7 +287,7 @@ in
254287
{
255288
type = "stat";
256289
title = "Power Draw";
257-
gridPos = { h = 8; w = 6; x = 18; y = 0; };
290+
gridPos = { h = 8; w = 6; x = 18; y = 6; };
258291
datasource = { type = "prometheus"; uid = "Prometheus"; };
259292
fieldConfig.defaults = {
260293
color.mode = "palette-classic";
@@ -267,7 +300,7 @@ in
267300
{
268301
type = "timeseries";
269302
title = "Input/Output Voltage";
270-
gridPos = { h = 8; w = 12; x = 0; y = 8; };
303+
gridPos = { h = 8; w = 12; x = 0; y = 14; };
271304
datasource = { type = "prometheus"; uid = "Prometheus"; };
272305
fieldConfig.defaults = { unit = "volt"; };
273306
options = { legend = { displayMode = "list"; placement = "bottom"; }; };
@@ -279,7 +312,7 @@ in
279312
{
280313
type = "timeseries";
281314
title = "Battery Voltage";
282-
gridPos = { h = 8; w = 12; x = 12; y = 8; };
315+
gridPos = { h = 8; w = 12; x = 12; y = 14; };
283316
datasource = { type = "prometheus"; uid = "Prometheus"; };
284317
fieldConfig.defaults = { unit = "volt"; };
285318
options = { legend = { displayMode = "list"; placement = "bottom"; }; };
@@ -292,7 +325,7 @@ in
292325
{
293326
type = "timeseries";
294327
title = "UPS Load Over Time";
295-
gridPos = { h = 8; w = 12; x = 0; y = 16; };
328+
gridPos = { h = 8; w = 12; x = 0; y = 22; };
296329
datasource = { type = "prometheus"; uid = "Prometheus"; };
297330
fieldConfig.defaults = { unit = "percent"; min = 0; max = 100; };
298331
options = { legend = { displayMode = "list"; placement = "bottom"; }; };
@@ -301,7 +334,7 @@ in
301334
{
302335
type = "timeseries";
303336
title = "Power Consumption";
304-
gridPos = { h = 8; w = 12; x = 12; y = 16; };
337+
gridPos = { h = 8; w = 12; x = 12; y = 22; };
305338
datasource = { type = "prometheus"; uid = "Prometheus"; };
306339
fieldConfig.defaults = { unit = "watt"; };
307340
options = { legend = { displayMode = "list"; placement = "bottom"; }; };
@@ -314,7 +347,7 @@ in
314347
{
315348
type = "timeseries";
316349
title = "Battery Charge Over Time";
317-
gridPos = { h = 8; w = 12; x = 0; y = 24; };
350+
gridPos = { h = 8; w = 12; x = 0; y = 30; };
318351
datasource = { type = "prometheus"; uid = "Prometheus"; };
319352
fieldConfig.defaults = { unit = "percent"; min = 0; max = 100; };
320353
options = { legend = { displayMode = "list"; placement = "bottom"; }; };
@@ -323,7 +356,7 @@ in
323356
{
324357
type = "timeseries";
325358
title = "UPS Efficiency";
326-
gridPos = { h = 8; w = 12; x = 12; y = 24; };
359+
gridPos = { h = 8; w = 12; x = 12; y = 30; };
327360
datasource = { type = "prometheus"; uid = "Prometheus"; };
328361
fieldConfig.defaults = { unit = "percent"; min = 0; max = 100; };
329362
options = { legend = { displayMode = "list"; placement = "bottom"; }; };
@@ -333,7 +366,7 @@ in
333366
{
334367
type = "timeseries";
335368
title = "Input/Output Frequency";
336-
gridPos = { h = 8; w = 24; x = 0; y = 32; };
369+
gridPos = { h = 8; w = 24; x = 0; y = 38; };
337370
datasource = { type = "prometheus"; uid = "Prometheus"; };
338371
fieldConfig.defaults = { unit = "hertz"; };
339372
options = { legend = { displayMode = "list"; placement = "bottom"; }; };

0 commit comments

Comments
 (0)