feat(host_agent): a temperature sensor is judged by how it moves against the CPU (#5783)
A board's spare thermistor inputs report whatever an open input reads, and the value rule from #5759 only catches the impossible ones. Once an hour, sensors.refresh judges each sensor against the host's CPU (Package id N, Tctl/Tdie/TccdN, PECI Agent N) over a week of hourly averages. A sensor is ruled out if it falls as the CPU warms (r <= -0.5) or holds within 0.5 °C while the CPU moved 10 °C or more. A judgment needs at least 72 shared hours. The host temperature leaves judged sensors out at ingest. The host page lists them under "Not counted", with each reason given once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -77,3 +77,21 @@ async def test_the_metrics_page_grades_by_the_same_cutoffs(app):
|
||||
assert 'class="stat-val tone-warn" style="font-size:1.6rem;">72°C' in page
|
||||
assert '<span class="tone-crit" style="font-variant-numeric:tabular-nums;">90°C' in page
|
||||
assert not hex_colours(page), hex_colours(page)
|
||||
|
||||
|
||||
async def test_sensors_not_counted_are_listed_once_per_reason(app):
|
||||
"""Util01's five open inputs read as one list with its reason, not five
|
||||
repeats of it; a sensor judged against the CPU carries its own (#5783)."""
|
||||
held = "reads a value no wired sensor gives"
|
||||
falls = "falls as the CPU warms (r -0.81 over 168 h)"
|
||||
async with app.test_request_context("/plugins/host_agent/h1/metrics"):
|
||||
page = await render_plugin_template(
|
||||
app, "host_agent", "_host_metrics.html", host=SimpleNamespace(address="10.0.0.2"), stale=False,
|
||||
reg=SimpleNamespace(distro=None, kernel=None, arch=None, agent_version=None,
|
||||
last_seen_at=datetime.now(timezone.utc)),
|
||||
hostlvl={"temp_c_max": 52.0}, cores=[], nets={}, disks_io={}, temps={"Package id 0": 52.0},
|
||||
unwired_temps={"SYSTIN": (115.0, held), "AUXTIN0": (110.0, held), "temp3": (62.0, falls)},
|
||||
mounts={})
|
||||
page = " ".join(page.split())
|
||||
assert (f"Not counted, likely nothing wired to them: temp3 62°C ({falls}); "
|
||||
f"SYSTIN 115°C, AUXTIN0 110°C ({held}).") in page
|
||||
|
||||
Reference in New Issue
Block a user