feat(hosts): the hottest sensor is named with its chip, and the host-reading cutoffs are read and set over MCP (#6806)
CI / lint (push) Successful in 1s
CI / unit (push) Successful in 1m39s
CI / integration (push) Successful in 2m2s
CI / publish (push) Successful in 1m12s

Agent 1.27.0 sends each temperature sensor's hwmon chip. Steward keeps the
chip per host and label beside the reading, so a sensor's metric key stays
its label, and the strip and the heat alert name it as "NVMe · Sensor 2"
rather than a bare "Sensor 2".

get_thresholds (viewer) and set_thresholds (admin, audited) read and change
the warn/crit cutoffs CPU, memory, disk, load and temperature are graded by,
as Settings → Thresholds does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-03 17:39:31 -05:00
co-authored by Claude Opus 5.5
parent 6eeb4039d7
commit 38ae99fb8e
9 changed files with 273 additions and 9 deletions
+6 -2
View File
@@ -124,13 +124,15 @@ def is_thermometer(host_name: str, label: str, celsius: float) -> bool:
def hottest_sensor(host_name: str, temps: dict[str, float]) -> list[str]:
"""Which sensor sets a host's temperature, as an alert on it says:
["Package id 0 at 86°C"], or [] with no thermometer among `temps`."""
["CPU · Package id 0 at 86°C"], or [] with no thermometer among `temps`.
The chip leads the label when the host's agent has said which it is."""
from steward.core.formatting import metric_value
real = {label: c for label, c in temps.items() if is_thermometer(host_name, label, c)}
if not real:
return []
from .sensors import sensor_name
label = max(real, key=real.get)
return [f"{label} at {metric_value('temp_c', real[label])}"]
return [f"{sensor_name(host_name, label)} at {metric_value('temp_c', real[label])}"]
async def name_hottest_sensor(session, resource: str) -> list[str]:
@@ -374,6 +376,8 @@ def _expand_sample_to_metrics(
# counts only readings that can be real (#5759), from sensors that behave
# like thermometers (#5783).
max_temp: float | None = None
from .sensors import note_chips
note_chips(host_name, sample.get("temps"))
for t in sample.get("temps") or []:
c = t.get("celsius")
if c is None: