Question

I'm sending a requests for snmp nodes using this example:

PDU pdu = new PDU();
pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.1.1")));
pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.1.9.1.2.1")));
pdu.setType(PDU.GETNEXT);

and results are:

Linux pia 2.6.26-2-686 #1 SMP Thu Sep 16 19:35:51 UTC 2010 i686
1.3.6.1.6.3.11.3.1.1

using listener:

Received response PDU is: RESPONSE[requestID=307256023, errorStatus=Success(0), errorIndex=0, VBS[1.3.6.1.2.1.1.9.1.2.2 = 1.3.6.1.6.3.11.3.1.1]]

and snmpwalk commands gives me these results:

root@pia:~/workspace_c/SNMP# snmpwalk -v2c -c public localhost 1.3.6.1.2.1.1.1
SNMPv2-MIB::sysDescr.0 = STRING: Linux pia 2.6.26-2-686 #1 SMP Thu Sep 16 19:35:51 UTC 2010 i686

root@pia:~/workspace_c/SNMP# snmpwalk -v2c -c public localhost 1.3.6.1.2.1.1.9.1.2.1
SNMPv2-MIB::sysORID.1 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance

Why snmpwalk returns SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance and snmp4j 1.3.6.1.6.3.11.3.1.1 ?

Why I've got the name of node in first case and the number of node in second???

UPDATE: Aha, it seems the nodes can be OID, STRING, Timesticks object:

  • 1.3.6.1.2.1.1.9.1.2.1 => OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
  • 1.3.6.1.2.1.1.9.1.3.1 => STRING: The SNMP Management Architecture MIB.
Was it helpful?

Solution

Isn't it exactly the same? (SNMP OIDs may be in the form of strings or "numbers with dots" - different representation but points to exactly the same information in tree).

From MIBExplorer:

snmpMPDCompliance MODULE-COMPLIANCE STATUS current DESCRIPTION "The compliance statement for SNMP entities which implement the SNMP-MPD-MIB. "

    MODULE 
    MANDATORY-GROUPS {
                    snmpMPDGroup }

-- 1.3.6.1.6.3.11.3.1.1 -- ::= { snmpMPDMIBCompliances 1 }

OTHER TIPS

For most applications the object name of a MIB object is not relevant and might by ambigous. SMI only requires object names to be unique within MIB modules and across all IETF standard MIB specifications.

Therefore, it is best practice to use the dotted number notation (e.g. "1.3.6.1.4.1") where possible. SNMP4J does not has a MIB parser built-in by default and thus provides dotted number OID strings.

However, if you want to have the object names or other value conversions defined by MIB specifications you can simply add SNMP4J-SMI with a few lines of code and you can use object names whereever you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top