feat(hosts): the hottest sensor is named with its chip, and the host-reading cutoffs are read and set over MCP (#6806)
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:
@@ -146,3 +146,19 @@ def test_build_sample_first_call_has_no_rates_but_keeps_state(monkeypatch):
|
||||
assert s1["net"] == [] and s1["diskio"] == [] # no prior counters yet
|
||||
assert state["mono"] is not None
|
||||
assert state["net"] == {"eth0": (1000, 500)}
|
||||
|
||||
|
||||
def test_collect_temps_says_which_chip_each_sensor_is_on(tmp_path, monkeypatch):
|
||||
nvme = tmp_path / "hwmon1"
|
||||
nvme.mkdir()
|
||||
(nvme / "name").write_text("nvme\n")
|
||||
(nvme / "temp3_input").write_text("49850\n")
|
||||
(nvme / "temp3_label").write_text("Sensor 2\n")
|
||||
bare = tmp_path / "hwmon2"
|
||||
bare.mkdir()
|
||||
(bare / "name").write_text("acpitz\n")
|
||||
(bare / "temp1_input").write_text("27800\n")
|
||||
monkeypatch.setattr(agent, "HWMON_DIR", str(tmp_path))
|
||||
got = sorted(agent.collect_temps(), key=lambda t: t["label"])
|
||||
assert got == [{"label": "Sensor 2", "celsius": 49.9, "chip": "nvme"},
|
||||
{"label": "acpitz_temp1", "celsius": 27.8, "chip": "acpitz"}]
|
||||
|
||||
Reference in New Issue
Block a user