ExportXMLWordPrintable

    • Type: Patch request
    • Resolution: Unresolved
    • Priority: Trivial
    • None
    • Affects Version/s: 7.4.16, 8.0.0
    • Component/s: Templates (T)
    • None

      Problem

      Items system.hw.model and system.hw.serialnumber poll get[1.3.6.1.2.1.47.1.1.1.1.13.1] and get[1.3.6.1.2.1.47.1.1.1.1.11.1], i.e. they assume the chassis is entPhysicalIndex 1. ENTITY-MIB (RFC 6933) does not guarantee that, and Cisco Catalyst IOS numbers physical entities as <switch number> * 1000 + n, so the chassis is at 1001 (2001, 3001... for stack members).

      Observed on a fleet of ~18 Cisco IOS devices:

      Device entPhysicalIndex 1 Result
      WS-C4510R+E chassis OK
      WS-C2960S / WS-C2960X (stackable) stack(11) entity (same layout as the walk in ZBX-19963), model/serial empty or not the chassis' Item supported but empty value; inventory MODEL / SERIALNO_A empty
      WS-C2960L, WS-C2960 PoE (non-stackable) does not exist Not supported: cannot get SNMP result: No Such Instance currently exists at this OID

      Evidence (WS-C2960L-16PS-LL, IOS 15.2(6)E):

      $ snmpwalk -v2c -c <community> <ip> 1.3.6.1.2.1.47.1.1.1.1.5
      ENTITY-MIB::entPhysicalClass.1001 = INTEGER: chassis(3)
      ENTITY-MIB::entPhysicalClass.1002 = INTEGER: module(9)
      ENTITY-MIB::entPhysicalClass.1003 = INTEGER: powerSupply(6)
      ...
      $ snmpget -v2c -c <community> <ip> 1.3.6.1.2.1.47.1.1.1.1.13.1001 1.3.6.1.2.1.47.1.1.1.1.13.1
      ENTITY-MIB::entPhysicalModelName.1001 = STRING: WS-C2960L-16PS-LL
      ENTITY-MIB::entPhysicalModelName.1 = No Such Instance currently exists at this OID
      

      No other fixed index works either. On the WS-C4510R+E (chassis at index 1), index 1000 is a line card and 1001 a port, so .1000 would silently report a module model and .1001 an empty string:

      ENTITY-MIB::entPhysicalClass.1 = INTEGER: chassis(3)       entPhysicalModelName.1    = WS-C4510R+E
      ENTITY-MIB::entPhysicalClass.1000 = INTEGER: module(9)     entPhysicalModelName.1000 = WS-X4648-RJ45V+E
      ENTITY-MIB::entPhysicalClass.1001 = INTEGER: port(10)      entPhysicalModelName.1001 = ""
      

      (The Nexus 9000 template works around this by hardcoding .149; that is not possible for a template covering all IOS platforms.)

      The same template already identifies chassis entities correctly in "Entity Serial Numbers Discovery" (filter {#ENT_CLASS} = ^3$); only these two plain items use the fixed index.

      Related issues

      • ZBX-19963 (fixed in 5.0.18 / 5.4.8 / 6.0): same root cause on the discovery side. The walk attached there from a Catalyst stack shows entPhysicalClass.1 = stack(11) and the chassis at index 1000; the fix was to select entities by {#ENT_CLASS} = ^3$. This patch applies the same criterion to the two plain items, which were left on the fixed index.
      • ZBXNEXT-9376 (open): SNMP dynamic indexes (entPhysicalModelName["index","entPhysicalClass","3"]) cannot be used with get[] / asynchronous pollers, so the classic dynamic-index fix is not available since templates moved to get[]/walk[] in ZBX-25104. Hence the walk + preprocessing approach.

      Proposed fix (patch attached)

      • Add entPhysicalModelName (1.3.6.1.2.1.47.1.1.1.1.13) to the existing master item system.hw.serialnumber.walk (no new SNMP requests; the LLD rule is unaffected because SNMP_WALK_TO_JSON only maps the columns it lists).
      • Convert system.hw.model and system.hw.serialnumber into dependent items of that walk: SNMP walk to JSON → JavaScript that selects the entity with the lowest entPhysicalIndex whose entPhysicalClass = chassis(3) → Discard unchanged with heartbeat 1d.
      • If no chassis entity exists, fall back to entPhysicalIndex 1 (previous behaviour), so devices that worked before keep working.
      • Item keys, UUIDs, inventory links and triggers are unchanged. README updated accordingly.
      • Scope: the patch only touches "Cisco IOS by SNMP". The other two templates in the same file ("Cisco IOS prior to 12.0_3_T by SNMP", "Cisco IOS versions 12.0_3_T-12.2_3.5 by SNMP") target IOS releases that are long end-of-life and are intentionally left unchanged.

      Vendor-agnostic: relies only on standard ENTITY-MIB semantics, not on Cisco index numbering.

      Behaviour on stacks

      On a stack, ENTITY-MIB exposes one stack(11) entity plus one chassis(3) entity per member (1001, 2001, ...). These items are single-valued host properties (and feed inventory MODEL / SERIALNO_A), so the patch reports the first member: the chassis entity with the lowest entPhysicalIndex, i.e. switch 1. This is in line with other NMSs; for example LibreNMS (LibreNMS/OS/Shared/Cisco.php) stores a single model/serial per device, taken from entPhysicalIndex 1 / 1000 / 1001, and keeps per-member data only in its separate entity inventory.

      Per-member serial numbers remain available through the existing "Entity Serial Numbers Discovery" rule (filter {#ENT_CLASS} = ^3$), which creates one item per chassis entity.

      Alternatives considered and rejected:

      • Empty value for stacks: loses information that is correct for switch 1.
      • Concatenating all members: the value changes whenever a member is added or removed (firing "Device has been replaced"), and it does not fit the inventory fields.

      Testing

      Preprocessing JavaScript extracted from the patched YAML and run against:

      Input system.hw.model system.hw.serialnumber
      Real WS-C2960L-16PS-LL walk (chassis at 1001) WS-C2960L-16PS-LL serial of 1001
      Stack: index 1 = stack(11), chassis 1001 and 2001 model of 1001 serial of 1001
      Real WS-C4510R+E walk (5900+ rows, chassis at 1, module at 1000, port at 1001) WS-C4510R+E serial of 1
      No chassis entity, index 1 present value of index 1 (fallback) value of index 1
      No chassis, no index 1 error: cannot find chassis entity same

      YAML validated with a YAML parser.

      I am using this patch in a production system with current 7.4.16 and it's working as expected.

      Note

      On stackable devices that previously stored an empty serial number, the first non-empty value will fire "Device has been replaced" once (last(#1)<>last(#2) with length(last())>0).

            Assignee:
            Bartosz Nems
            Reporter:
            Joan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: