I am trying to develop a net-snmp subagent, and came across something confusing.

Why I can not get a net-snmp table column but 'getnext' is ok in mib-browser?

I generated the code by mib2c -c mib2c.iterate.conf.

In mib-browser, get operation alerts: can not retrieve data. unknown oid ...,
getnext is okay.

So, why ? Does it have something to do with mib2c.iterate.conf ?

有帮助吗?

解决方案

Quoting snmpgetnext man page:

the variable that is lexicographically "next" in the remote entity's MIB will be returned. For example: snmpgetnext -c public zeus interfaces.ifTable.ifEntry.ifType.1 will retrieve the variable interfaces.ifTable.ifEntry.ifType.2: interfaces.ifTable.ifEntry.ifType.2 = softwareLoopback(24)

in other words, the OID you are looking up does not exist so GET fails but the one lexicographically after it gets returned ok via GETNEXT.

$ snmpget -v 2C -c public myserver .1.3.6.1.2.1.4.31.3.1.3.2.9
IP-MIB::ipIfStatsInReceives.ipv6.9 = Counter32: 48

$ snmpgetnext -v 2C -c public myserver .1.3.6.1.2.1.4.31.3.1.3.2.9
IP-MIB::ipIfStatsInReceives.ipv6.10 = Counter32: 24

$ snmpget -v 2C -c public myserver .1.3.6.1.2.1.4.31.3.1.3.2.10
IP-MIB::ipIfStatsInReceives.ipv6.10 = Counter32: 24
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top