Skip to content

feat(routers): merge the SNMP port surface into pusher polls - #1753

Merged
gnacho merged 1 commit into
mainfrom
feat/1726-snmp-second-source
Nov 1, 2026
Merged

gnacho merged 1 commit into
mainfrom
feat/1726-snmp-second-source

Conversation

@gnacho

@gnacho gnacho commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Closes #1726

A unit can have snmp_enabled and also be fed by a pusher. pollRouter returns as soon as there is a fresh agent payload, so the SNMP branch never ran and the setting was a silent no-op.

This adds SNMP as a second source in that path. It only fills what the payload cannot provide:

  • link speed per port (RouterOS does not expose it through the API, and the child switch reports ifHighSpeed=0 in up ports)
  • error counters (ifErrors/ifInErrors, only available over SNMP)
  • LLDP neighbours (RouterOS 7.25 has no /interface/lldp menu), which replaces the FDB guess that labels sfp-sfpplus1 as the wrong peer

What it does not touch: CPU, RAM and temperature (the payload wins since #1724) and the FDB (the agent already sends it). A payload value is never overwritten: the merge only fills empty speeds and zero counters, and an ifHighSpeed=0 from a down port is not propagated as a speed.

The SNMP surface is cached per router with the same interval as the SNMP poller (snmp_poll_interval, 60 s by default), so a 30 s pusher does not turn into two SNMP walks per minute. It reuses recordSnmpSuccess and recordSnmpFailure, so the existing "SNMP polling failing" alert still fires on these units. It skips recordPortSamples and portMon.Observe on purpose: the pusher already persists its own series with its own port IDs, and duplicating them here would interleave snmp-N rows with the real ones.

Five tests cover the merge rules, the down-link case, payload priority for LLDP, the fresh-cache path (no second walk) and the disabled case.

@gnacho
gnacho merged commit 792bb12 into main Nov 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(snmp): a pusher-fed unit is never SNMP-polled, so snmp_enabled is a silent no-op

1 participant