fix(snmp): a disk listed late in UCD-DISKIO is read, and Asustor disks are named by bay (#5992)
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:
@@ -222,9 +222,13 @@ async def poll_device(address: str, port: int, creds: Credentials,
|
||||
_close_engine(engine)
|
||||
|
||||
|
||||
# Rows read of one table: enough for any NAS's disks and volumes, and a bound
|
||||
# on a device that answers a walk forever.
|
||||
# Rows kept of one table: enough for any NAS's disks and volumes.
|
||||
ROWS_PER_TABLE = 64
|
||||
# Entries walked of one column, before rows_like keeps the physical disks: a
|
||||
# Synology's UCD-DISKIO lists RAM disks, loops, partitions and md arrays ahead
|
||||
# of a disk added late, so the bound is on the walk, not on the rows kept, and
|
||||
# it only stops a device that answers a walk forever.
|
||||
ENTRIES_PER_COLUMN = 1024
|
||||
|
||||
|
||||
async def _walk_column(api, engine, auth, transport, column: str) -> dict[str, object] | str:
|
||||
@@ -243,7 +247,7 @@ async def _walk_column(api, engine, auth, transport, column: str) -> dict[str, o
|
||||
if type(val).__name__ in _ABSENT or not oid.startswith(column + "."):
|
||||
continue
|
||||
found[oid[len(column) + 1:]] = val
|
||||
if len(found) >= ROWS_PER_TABLE:
|
||||
if len(found) >= ENTRIES_PER_COLUMN:
|
||||
break
|
||||
return found
|
||||
|
||||
|
||||
Reference in New Issue
Block a user