monitoring(overview): refine ups-climate row and climate/fan stat display

This commit is contained in:
Brad Stein 2026-04-04 04:40:22 -03:00
parent 8b9c5ee5ed
commit d8bcd24dac
4 changed files with 24 additions and 18 deletions

View File

@ -647,6 +647,7 @@ def stat_panel(
field_overrides=None,
description=None,
orientation=None,
wide_layout=None,
):
"""Return a Grafana stat panel definition."""
defaults = {
@ -687,6 +688,8 @@ def stat_panel(
}
if orientation:
panel["options"]["orientation"] = orientation
if wide_layout is not None:
panel["options"]["wideLayout"] = wide_layout
if legend and len(panel["targets"]) == 1:
panel["targets"][0]["legendFormat"] = legend
if instant:
@ -1337,11 +1340,12 @@ def build_overview():
],
field_overrides=[
{"matcher": {"id": "byName", "options": "Tent Temp (°C)"}, "properties": [{"id": "unit", "value": "celsius"}]},
{"matcher": {"id": "byName", "options": "Tent Pressure (kPa)"}, "properties": [{"id": "unit", "value": "none"}]},
{"matcher": {"id": "byName", "options": "Tent Pressure (kPa)"}, "properties": [{"id": "unit", "value": "suffix:kPa"}]},
],
links=link_to("atlas-power"),
description="Current tent temperature and pressure.",
orientation="vertical",
wide_layout=False,
)
)
panels.append(
@ -1381,10 +1385,10 @@ def build_overview():
decimals=0,
text_mode="name_and_value",
targets=[
{"refId": "A", "expr": CLIMATE_FAN_OUTLET_CURRENT, "legendFormat": "Outlet", "instant": True},
{"refId": "B", "expr": CLIMATE_FAN_INSIDE_INLET_CURRENT, "legendFormat": "Inside Inlet", "instant": True},
{"refId": "C", "expr": CLIMATE_FAN_OUTSIDE_INLET_CURRENT, "legendFormat": "Outside Inlet", "instant": True},
{"refId": "D", "expr": CLIMATE_FAN_INTERIOR_CURRENT, "legendFormat": "Interior", "instant": True},
{"refId": "A", "expr": f"round({CLIMATE_FAN_OUTLET_CURRENT})", "legendFormat": "Outlet", "instant": True},
{"refId": "B", "expr": f"round({CLIMATE_FAN_INSIDE_INLET_CURRENT})", "legendFormat": "Inside Inlet", "instant": True},
{"refId": "C", "expr": f"round({CLIMATE_FAN_OUTSIDE_INLET_CURRENT})", "legendFormat": "Outside Inlet", "instant": True},
{"refId": "D", "expr": f"round({CLIMATE_FAN_INTERIOR_CURRENT})", "legendFormat": "Interior", "instant": True},
],
thresholds={
"mode": "absolute",

View File

@ -1396,7 +1396,7 @@
"properties": [
{
"id": "unit",
"value": "none"
"value": "suffix:kPa"
}
]
}
@ -1414,7 +1414,8 @@
"values": false
},
"textMode": "value",
"orientation": "vertical"
"orientation": "vertical",
"wideLayout": false
},
"links": [
{
@ -1516,25 +1517,25 @@
"targets": [
{
"refId": "A",
"expr": "max(atlas_climate_fan_activity_level{fan_group=\"outlet\"}) or max(atlas_climate_fan_activity_level{position=\"outlet\"}) or on() vector(0)",
"expr": "round(max(atlas_climate_fan_activity_level{fan_group=\"outlet\"}) or max(atlas_climate_fan_activity_level{position=\"outlet\"}) or on() vector(0))",
"legendFormat": "Outlet",
"instant": true
},
{
"refId": "B",
"expr": "max(atlas_climate_fan_activity_level{fan_group=\"inside_inlet\"}) or max(atlas_climate_fan_activity_level{position=\"inside_inlet\"}) or on() vector(0)",
"expr": "round(max(atlas_climate_fan_activity_level{fan_group=\"inside_inlet\"}) or max(atlas_climate_fan_activity_level{position=\"inside_inlet\"}) or on() vector(0))",
"legendFormat": "Inside Inlet",
"instant": true
},
{
"refId": "C",
"expr": "max(atlas_climate_fan_activity_level{fan_group=\"outside_inlet\"}) or max(atlas_climate_fan_activity_level{position=\"outside_inlet\"}) or on() vector(0)",
"expr": "round(max(atlas_climate_fan_activity_level{fan_group=\"outside_inlet\"}) or max(atlas_climate_fan_activity_level{position=\"outside_inlet\"}) or on() vector(0))",
"legendFormat": "Outside Inlet",
"instant": true
},
{
"refId": "D",
"expr": "max(atlas_climate_fan_activity_level{fan_group=\"interior\"}) or max(atlas_climate_fan_activity_level{position=\"interior\"}) or on() vector(0)",
"expr": "round(max(atlas_climate_fan_activity_level{fan_group=\"interior\"}) or max(atlas_climate_fan_activity_level{position=\"interior\"}) or on() vector(0))",
"legendFormat": "Interior",
"instant": true
}

View File

@ -1405,7 +1405,7 @@ data:
"properties": [
{
"id": "unit",
"value": "none"
"value": "suffix:kPa"
}
]
}
@ -1423,7 +1423,8 @@ data:
"values": false
},
"textMode": "value",
"orientation": "vertical"
"orientation": "vertical",
"wideLayout": false
},
"links": [
{
@ -1525,25 +1526,25 @@ data:
"targets": [
{
"refId": "A",
"expr": "max(atlas_climate_fan_activity_level{fan_group=\"outlet\"}) or max(atlas_climate_fan_activity_level{position=\"outlet\"}) or on() vector(0)",
"expr": "round(max(atlas_climate_fan_activity_level{fan_group=\"outlet\"}) or max(atlas_climate_fan_activity_level{position=\"outlet\"}) or on() vector(0))",
"legendFormat": "Outlet",
"instant": true
},
{
"refId": "B",
"expr": "max(atlas_climate_fan_activity_level{fan_group=\"inside_inlet\"}) or max(atlas_climate_fan_activity_level{position=\"inside_inlet\"}) or on() vector(0)",
"expr": "round(max(atlas_climate_fan_activity_level{fan_group=\"inside_inlet\"}) or max(atlas_climate_fan_activity_level{position=\"inside_inlet\"}) or on() vector(0))",
"legendFormat": "Inside Inlet",
"instant": true
},
{
"refId": "C",
"expr": "max(atlas_climate_fan_activity_level{fan_group=\"outside_inlet\"}) or max(atlas_climate_fan_activity_level{position=\"outside_inlet\"}) or on() vector(0)",
"expr": "round(max(atlas_climate_fan_activity_level{fan_group=\"outside_inlet\"}) or max(atlas_climate_fan_activity_level{position=\"outside_inlet\"}) or on() vector(0))",
"legendFormat": "Outside Inlet",
"instant": true
},
{
"refId": "D",
"expr": "max(atlas_climate_fan_activity_level{fan_group=\"interior\"}) or max(atlas_climate_fan_activity_level{position=\"interior\"}) or on() vector(0)",
"expr": "round(max(atlas_climate_fan_activity_level{fan_group=\"interior\"}) or max(atlas_climate_fan_activity_level{position=\"interior\"}) or on() vector(0))",
"legendFormat": "Interior",
"instant": true
}

View File

@ -296,7 +296,7 @@ spec:
podAnnotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/role: "monitoring"
monitoring.bstein.dev/restart-rev: "9"
monitoring.bstein.dev/restart-rev: "10"
vault.hashicorp.com/agent-inject-secret-grafana-env.sh: "kv/data/atlas/monitoring/grafana-admin"
vault.hashicorp.com/agent-inject-template-grafana-env.sh: |
{{ with secret "kv/data/atlas/monitoring/grafana-admin" }}