fix(snmp): a disk listed late in UCD-DISKIO is read, and Asustor disks are named by bay (#5992)
CI / lint (push) Successful in 2s
CI / unit (push) Successful in 1m37s
CI / integration (push) Successful in 1m50s
CI / publish (push) Successful in 1m29s

The table walk stopped after 64 raw entries, counting the RAM disks, loops,
partitions and md arrays that rows_like then drops, so a Synology's eighth
disk was never reached. The walk is now bounded at 1,024 entries per column;
64 still caps the rows kept.

ADM labels its disks "Disk0".."Disk4" while their indexes run 1..5; the
Asustor disk table now names each row by its index ("Disk 1"). Keys are
unchanged, so history carries on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 23:16:25 -04:00
co-authored by Claude Opus 5.5
parent d065cafd11
commit bd1c32d2a4
4 changed files with 30 additions and 6 deletions
+9
View File
@@ -185,6 +185,15 @@ def test_a_table_walk_finds_each_row_its_label_and_the_columns_it_answered(monke
{"index": "1", "label": "Disk 1", "columns": ["status", "temp"]}]}
def test_a_disk_listed_after_many_partitions_and_loops_is_still_found(monkeypatch):
from plugins.snmp.readings import TABLES
[diskio] = TABLES["linux"]
labels = {str(i): f"loop{i}" for i in range(1, 80)} | {"80": "sdh", "81": "sdh1"}
_walk(monkeypatch, {diskio.label: labels, diskio.columns[0].oid: {i: 5 for i in labels}})
scan = asyncio.run(poller.walk_tables("10.0.0.2", 161, Credentials(community="public"), [diskio]))
assert scan.rows == {"ucd_diskio": [{"index": "80", "label": "sdh", "columns": ["busy"]}]}
def test_a_table_walk_with_no_reply_says_what_to_check(monkeypatch):
from plugins.snmp.readings import Column, Table
_walk(monkeypatch, {}, error="No SNMP response received before timeout")
+6
View File
@@ -86,6 +86,12 @@ def test_a_table_row_is_keyed_by_its_index_and_named_by_its_label():
assert got[0].states == "words"
def test_an_asustor_disk_is_named_by_its_bay_not_adms_zero_based_label():
disks = next(t for t in TABLES["asustor"] if t.id == "asustor_disks")
got = table_readings(disks, [{"index": "1", "label": "Disk0", "columns": ["status"]}])
assert [(r.key, r.name) for r in got] == [("disk1_status", "Disk 1 status")]
def test_a_table_without_labels_is_named_by_its_columns():
fans = Table("f", "", "", "Fan", (Column("9.2", "fan", "Fan speed", "rpm"),))
[one] = table_readings(fans, [{"index": "1", "label": "", "columns": ["fan"]}])