在 SNMP table 中使用非代理索引

Using a non-surrogate index in an SNMP table

我有 key:value 数据,我想按原样显示。我读过的所有内容都表明,如果某个列是键,那么它应该是 not-accessible,因此不会被工具显示(OTOH 我不确定 RFC 2579 的相关部分是否这么说,这对我来说太难了理解),但我不想添加代理键,因为我在数据中已经有一个唯一键。是否可以规避或唯一可接受的方法是添加代理标识符?

如果您愿意,可以通过工具显示带有 MAX-ACCESS not-accessible 的 SNMP table 行键。看看 NetSnmp snmptable explanation ...

... One thing missing from the tables above, is any indication of the index values for each row. The earliest MIB tables (and some more recent, but poorly designed tables) did define the indexes as accessible objects, which would therefore appear in the snmptable output. But current MIB design has recognised that the index values are included in the instance OIDs, so it is not necessary to explicitly retrieve them as a separate column object.

By default, the snmptable command ignores these index values, but it will display them if invoked with the -Ci option.

我将其解释为:由于 index 隐含在 OID 中,因此有时不需要显示它,但如果您正在打印整个 table(使用 snmptable 工具)看到它通常很方便,因此 NetSnmp 提供了 -Ci 标志(忽略索引的 MAX-ACCESS 级别)。

示例 不显示 索引列:

snmptable -M +.  -m +ALL -v 2c -c public -Pu  <my server>  SNMPv2-MIB::sysORTable
SNMP table: SNMPv2-MIB::sysORTable

                                        sysORID                                              sysORDescr  sysORUpTime
          SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1         The MIB for Message Processing and Dispatching. 0:0:00:00.18
       SNMP-USER-BASED-SM-MIB::usmMIBCompliance         The MIB for Message Processing and Dispatching. 0:0:00:00.18
       // SNIP ...

示例 显示 索引列:

snmptable -M +.  -m +ALL -v 2c -c public -Pu -Ci  <my server>  SNMPv2-MIB::sysORTable
SNMP table: SNMPv2-MIB::sysORTable

 index                                        sysORID                                              sysORDescr  sysORUpTime
     1          SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1         The MIB for Message Processing and Dispatching. 0:0:00:00.18
     2       SNMP-USER-BASED-SM-MIB::usmMIBCompliance         The MIB for Message Processing and Dispatching. 0:0:00:00.18
  // SNIP ...