[SNMP4J] Incorrect OID returned after GETBULK request

Iker Almandoz ikeralmandoz.lists at gmail.com
Mon Jun 2 17:54:12 CEST 2008


Hi Anton, 

GETBULK is the equivalent of GETNEXT and not of GET.  GETBULK will always
return the n next OIDs from the OID you provide (non-inclusive).
See
http://snmp.adventnet.com/help/snmpapi/snmpv3/snmp_operations/snmp_getbulk.h
tml for example for more info, 

Regards, 
Iker

-----Original Message-----
From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On
Behalf Of Anton Boronnikov
Sent: Monday, June 02, 2008 9:26 AM
To: snmp4j at agentpp.org
Subject: [SNMP4J] Incorrect OID returned after GETBULK request

I have this kind of code:

  Address targetAddress = GenericAddress.parse("udp:192.168.1.213/161");

     CommunityTarget target = new CommunityTarget();
     target.setCommunity(new OctetString("private"));
     target.setAddress(targetAddress);
     target.setRetries(2);
     target.setTimeout(1500);
     target.setVersion(SnmpConstants.version1);

     TransportMapping transport = new DefaultUdpTransportMapping();

     Snmp snmp = new Snmp(transport);
     transport.listen();

     PDU pdu = new PDU();
     pdu.setType(PDU.GETBULK);
     //pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.2.2.1.21.1")));
     pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.1.1.0")));
     ResponseEvent response = snmp.send(pdu, target);
     for (Object vb : response.getResponse().getVariableBindings())
     {
       System.out.println(vb.toString());
     }

When I execute it I get this message in System.out:
"1.3.6.1.2.1.1.2.0 = 1.3.6.1.4.1.1723.2.1.2"

Hey! I've requested another OID! There was "1.3.6.1.2.1.1.1.0" oid asked  
for! You can try any other oid! The same story! Returned oid has always  
incremented number in last but one position. What a hell??
Another story if I will request for "1.3.6.1.2.1.1.1" oid (without last  
number). There will be the answer:
"1.3.6.1.2.1.1.1.0 = TRh-Sensor Firmware Version 1-5-1.04"

Can anybody test my code and comment this situation? May be my code is  
incorrect abit? Or there is some another reason?

-- 
Yours respectfully, Anton Boronnikov
_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j




More information about the SNMP4J mailing list