bundles/grafana: fix value for battery dashboard row
Some checks failed
kunsi/bundlewrap/pipeline/head There was a failure building this commit

This commit is contained in:
Franzi 2021-11-15 21:26:23 +01:00
parent e17d1ab02f
commit 7969ae9ebe
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -70,9 +70,10 @@ def dashboard_row_battery(panel_id, node):
) )
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value") |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> map(fn: (r) => ({{ |> map(fn: (r) => ({{
r with r with
_value: float(v: r.energy_now) / float(v: r.energy_full) * 100.0 _value: float(v: r.energy_now) / float(v: r.energy_full) * 100.0
}})) }})
)
|> drop(columns: ["energy_now", "energy_full"])""", |> drop(columns: ["energy_now", "energy_full"])""",
'resultFormat': 'time_series', 'resultFormat': 'time_series',
'select': [[ 'select': [[
@ -182,6 +183,11 @@ def dashboard_row_battery(panel_id, node):
r["_field"] == "power_now" and r["_field"] == "power_now" and
r["host"] == "{node.name}" r["host"] == "{node.name}"
) )
|> map(fn: (r) => ({{
r with
_value: float(v: r._value) / 1000000.0
}})
)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false) |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "fan")""", |> yield(name: "fan")""",
'resultFormat': 'time_series', 'resultFormat': 'time_series',