@@ -180,17 +180,180 @@ in
180180 '' ;
181181 } ;
182182
183- # NUT dashboard
183+ # NUT dashboard - Custom dashboard for Eaton 5SC UPS
184184 environment . etc . "grafana-dashboards/nut/nut-dashboard.json" = lib . mkIf cfg . enableUps {
185- text =
186- let
187- raw = builtins . fetchurl {
188- url = "https://grafana.com/api/dashboards/15406/revisions/1/download" ;
189- sha256 = "1pvyyxyy6prd0aqkvki04ayr4sw2rfyzx9gc3scyhzjy6rq648ca" ;
190- } ;
191- fixed = builtins . replaceStrings [ "\ ${DS_PROMETHEUS}" ] [ "Prometheus" ] ( builtins . readFile raw ) ;
192- in
193- fixed ;
185+ text = builtins . toJSON {
186+ annotations . list = [ ] ;
187+ editable = true ;
188+ fiscalYearStartMonth = 0 ;
189+ graphTooltip = 0 ;
190+ links = [ ] ;
191+ panels = [
192+ # Row 1: Status gauges
193+ {
194+ type = "gauge" ;
195+ title = "Battery Charge" ;
196+ gridPos = { h = 8 ; w = 6 ; x = 0 ; y = 0 ; } ;
197+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
198+ fieldConfig . defaults = {
199+ color . mode = "thresholds" ;
200+ thresholds . mode = "absolute" ;
201+ thresholds . steps = [
202+ { color = "red" ; value = null ; }
203+ { color = "orange" ; value = 30 ; }
204+ { color = "yellow" ; value = 50 ; }
205+ { color = "green" ; value = 80 ; }
206+ ] ;
207+ unit = "percent" ;
208+ min = 0 ;
209+ max = 100 ;
210+ } ;
211+ options = { reduceOptions = { calcs = [ "lastNotNull" ] ; } ; } ;
212+ targets = [ { expr = "network_ups_tools_battery_charge" ; refId = "A" ; } ] ;
213+ }
214+ {
215+ type = "gauge" ;
216+ title = "UPS Load" ;
217+ gridPos = { h = 8 ; w = 6 ; x = 6 ; y = 0 ; } ;
218+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
219+ fieldConfig . defaults = {
220+ color . mode = "thresholds" ;
221+ thresholds . mode = "absolute" ;
222+ thresholds . steps = [
223+ { color = "green" ; value = null ; }
224+ { color = "yellow" ; value = 50 ; }
225+ { color = "orange" ; value = 75 ; }
226+ { color = "red" ; value = 90 ; }
227+ ] ;
228+ unit = "percent" ;
229+ min = 0 ;
230+ max = 100 ;
231+ } ;
232+ options = { reduceOptions = { calcs = [ "lastNotNull" ] ; } ; } ;
233+ targets = [ { expr = "network_ups_tools_ups_load" ; refId = "A" ; } ] ;
234+ }
235+ {
236+ type = "stat" ;
237+ title = "Runtime Remaining" ;
238+ gridPos = { h = 8 ; w = 6 ; x = 12 ; y = 0 ; } ;
239+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
240+ fieldConfig . defaults = {
241+ color . mode = "thresholds" ;
242+ thresholds . mode = "absolute" ;
243+ thresholds . steps = [
244+ { color = "red" ; value = null ; }
245+ { color = "orange" ; value = 300 ; }
246+ { color = "yellow" ; value = 600 ; }
247+ { color = "green" ; value = 1200 ; }
248+ ] ;
249+ unit = "s" ;
250+ } ;
251+ options = { reduceOptions = { calcs = [ "lastNotNull" ] ; } ; colorMode = "value" ; } ;
252+ targets = [ { expr = "network_ups_tools_battery_runtime" ; refId = "A" ; } ] ;
253+ }
254+ {
255+ type = "stat" ;
256+ title = "Power Draw" ;
257+ gridPos = { h = 8 ; w = 6 ; x = 18 ; y = 0 ; } ;
258+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
259+ fieldConfig . defaults = {
260+ color . mode = "palette-classic" ;
261+ unit = "watt" ;
262+ } ;
263+ options = { reduceOptions = { calcs = [ "lastNotNull" ] ; } ; colorMode = "value" ; } ;
264+ targets = [ { expr = "network_ups_tools_ups_realpower" ; legendFormat = "Real Power" ; refId = "A" ; } ] ;
265+ }
266+ # Row 2: Voltage and current graphs
267+ {
268+ type = "timeseries" ;
269+ title = "Input/Output Voltage" ;
270+ gridPos = { h = 8 ; w = 12 ; x = 0 ; y = 8 ; } ;
271+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
272+ fieldConfig . defaults = { unit = "volt" ; } ;
273+ options = { legend = { displayMode = "list" ; placement = "bottom" ; } ; } ;
274+ targets = [
275+ { expr = "network_ups_tools_input_voltage" ; legendFormat = "Input" ; refId = "A" ; }
276+ { expr = "network_ups_tools_output_voltage" ; legendFormat = "Output" ; refId = "B" ; }
277+ ] ;
278+ }
279+ {
280+ type = "timeseries" ;
281+ title = "Battery Voltage" ;
282+ gridPos = { h = 8 ; w = 12 ; x = 12 ; y = 8 ; } ;
283+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
284+ fieldConfig . defaults = { unit = "volt" ; } ;
285+ options = { legend = { displayMode = "list" ; placement = "bottom" ; } ; } ;
286+ targets = [
287+ { expr = "network_ups_tools_battery_voltage" ; legendFormat = "Battery" ; refId = "A" ; }
288+ { expr = "network_ups_tools_battery_voltage_nominal" ; legendFormat = "Nominal" ; refId = "B" ; }
289+ ] ;
290+ }
291+ # Row 3: Load and runtime over time
292+ {
293+ type = "timeseries" ;
294+ title = "UPS Load Over Time" ;
295+ gridPos = { h = 8 ; w = 12 ; x = 0 ; y = 16 ; } ;
296+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
297+ fieldConfig . defaults = { unit = "percent" ; min = 0 ; max = 100 ; } ;
298+ options = { legend = { displayMode = "list" ; placement = "bottom" ; } ; } ;
299+ targets = [ { expr = "network_ups_tools_ups_load" ; legendFormat = "Load %" ; refId = "A" ; } ] ;
300+ }
301+ {
302+ type = "timeseries" ;
303+ title = "Power Consumption" ;
304+ gridPos = { h = 8 ; w = 12 ; x = 12 ; y = 16 ; } ;
305+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
306+ fieldConfig . defaults = { unit = "watt" ; } ;
307+ options = { legend = { displayMode = "list" ; placement = "bottom" ; } ; } ;
308+ targets = [
309+ { expr = "network_ups_tools_ups_realpower" ; legendFormat = "Real Power (W)" ; refId = "A" ; }
310+ { expr = "network_ups_tools_ups_power" ; legendFormat = "Apparent Power (VA)" ; refId = "B" ; }
311+ ] ;
312+ }
313+ # Row 4: Battery and efficiency
314+ {
315+ type = "timeseries" ;
316+ title = "Battery Charge Over Time" ;
317+ gridPos = { h = 8 ; w = 12 ; x = 0 ; y = 24 ; } ;
318+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
319+ fieldConfig . defaults = { unit = "percent" ; min = 0 ; max = 100 ; } ;
320+ options = { legend = { displayMode = "list" ; placement = "bottom" ; } ; } ;
321+ targets = [ { expr = "network_ups_tools_battery_charge" ; legendFormat = "Charge %" ; refId = "A" ; } ] ;
322+ }
323+ {
324+ type = "timeseries" ;
325+ title = "UPS Efficiency" ;
326+ gridPos = { h = 8 ; w = 12 ; x = 12 ; y = 24 ; } ;
327+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
328+ fieldConfig . defaults = { unit = "percent" ; min = 0 ; max = 100 ; } ;
329+ options = { legend = { displayMode = "list" ; placement = "bottom" ; } ; } ;
330+ targets = [ { expr = "network_ups_tools_ups_efficiency" ; legendFormat = "Efficiency %" ; refId = "A" ; } ] ;
331+ }
332+ # Row 5: Frequency
333+ {
334+ type = "timeseries" ;
335+ title = "Input/Output Frequency" ;
336+ gridPos = { h = 8 ; w = 24 ; x = 0 ; y = 32 ; } ;
337+ datasource = { type = "prometheus" ; uid = "Prometheus" ; } ;
338+ fieldConfig . defaults = { unit = "hertz" ; } ;
339+ options = { legend = { displayMode = "list" ; placement = "bottom" ; } ; } ;
340+ targets = [
341+ { expr = "network_ups_tools_input_frequency" ; legendFormat = "Input" ; refId = "A" ; }
342+ { expr = "network_ups_tools_output_frequency" ; legendFormat = "Output" ; refId = "B" ; }
343+ ] ;
344+ }
345+ ] ;
346+ refresh = "30s" ;
347+ schemaVersion = 39 ;
348+ tags = [ "ups" "nut" "eaton" ] ;
349+ templating . list = [ ] ;
350+ time = { from = "now-6h" ; to = "now" ; } ;
351+ timepicker = { } ;
352+ timezone = "browser" ;
353+ title = "Eaton 5SC UPS" ;
354+ uid = "eaton-5sc-ups" ;
355+ version = 1 ;
356+ } ;
194357 user = "grafana" ;
195358 group = "grafana" ;
196359 mode = "0644" ;
0 commit comments