feat(hosts): the live strip shows the hottest sensor's temperature, get_host marks sensors that don't count, and the Monitors card's button reads "Add" (#6803)
- The host page's live strip gains a Temperature tile: temp_c_max (real thermometers only), its last 6 h and the sensor setting it, graded by Settings → Thresholds and counted in the header's worst reading, in °C. - MCP get_host: each temperature carries `counted`; an unwired input is `counted: false` with `not_counted_because`, listed after the real ones. host_agent registers the judge (judge_sensors), so core imports no plugin. - The Monitors card's "Add monitor" wrapped into two lines beside the uptime; it reads "Add", titled "Add a monitor for this host". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+16
-1
@@ -312,10 +312,25 @@ def test_get_host_groups_parts_by_kind_and_summarises_cores():
|
||||
assert got["disk_io"]["items"][0]["device"] == "sda"
|
||||
assert [d["device"] for d in got["drive_health"]["items"]] == ["nvme0", "sda"] # failing first
|
||||
assert got["temperatures"]["items"][0] == {"sensor": "Package id 0", "part": "temp:Package id 0",
|
||||
"temp_c": 61.0}
|
||||
"temp_c": 61.0, "counted": True}
|
||||
assert "other" not in got
|
||||
|
||||
|
||||
def test_get_host_marks_the_sensors_the_hosts_temperature_leaves_out(monkeypatch):
|
||||
"""An unwired input reading 115 °C is listed after the real sensors, with
|
||||
why it doesn't count, so a reader doesn't take it for heat."""
|
||||
from steward.mcp.tools import hosts
|
||||
monkeypatch.setattr(hosts, "_UNCOUNTED_SENSORS",
|
||||
lambda host, temps: {k: "reads a value no wired sensor gives"
|
||||
for k, c in temps.items() if c >= 100})
|
||||
got = hosts.agent_parts({"temp:SYSTIN": {"temp_c": 115.0}, "temp:Package id 0": {"temp_c": 61.0},
|
||||
"temp:nvme": {"temp_c": 40.0}}, "box", limit=10)["temperatures"]["items"]
|
||||
assert [t["sensor"] for t in got] == ["Package id 0", "nvme", "SYSTIN"]
|
||||
assert got[0]["counted"] is True and "not_counted_because" not in got[0]
|
||||
assert got[2]["counted"] is False
|
||||
assert got[2]["not_counted_because"] == "reads a value no wired sensor gives"
|
||||
|
||||
|
||||
def test_one_silent_agent_is_one_finding():
|
||||
"""#5721: VDNT-Docker03's silent agent read as three findings. Its agent-
|
||||
offline alert speaks for it, the stale-agent finding goes, and its rules
|
||||
|
||||
Reference in New Issue
Block a user