[SNMP4J] GETBULK Problem

Frank Fock fock at agentpp.com
Fri Mar 23 23:39:57 CET 2007


Hello Ricardo,

Most likely this is a bug/limitation of the agent.
There are many devices that do not implement GETBULK
correctly/fully.

Best regards,
Frank

Ricardo Bandeira wrote:
> Hello,
> 
> I´m trying to use snmp4j to comunnicate with an DSLAM using snmpV2 . I make a simple example for make a GETBULK to a table of a MIB, and the Response is like a GETNEXT, I just have 1 result in the response.
> 
> If somebody knows who I do wrong please help. My client example is below.
> 
> public class client{
> 
> 
> 
> 
> 
> public client(){ 
> 
> 
> }
> 
> 
> 
> public static void main(String[] args){
> 
> 
> ResponseEvent response=null;
> 
> PDU responsePDU = null;
> 
> Vector vb = new Vector();
> 
> VariableBinding[] variableB = null;
> 
> 
> 
> try{
> 
> String NeIPaddress = "udp:"+args[0]+"/161";
> 
> 
> System.out.println("NeIPaddress: "+NeIPaddress);
> 
> 
> Address targetAddress = GenericAddress.parse(NeIPaddress);
> 
> TransportMapping transport = new DefaultUdpTransportMapping();
> 
> Snmp snmp = new Snmp(transport);
> 
> transport.listen();
> 
> 
> 
> //setting up target
> 
> CommunityTarget target = new CommunityTarget();
> 
> target.setCommunity(new OctetString("public"));
> 
> target.setAddress(targetAddress);
> 
> target.setRetries(4);
> 
> target.setTimeout(1500);
> 
> target.setVersion(SnmpConstants.version2c);
> 
> // creating PDU
> 
> PDU pdu = new PDU();
> 
> pdu.add(new VariableBinding(new OID("1.3.6.1.4.1.231.7.1.2.2.1.4.2.1.1.2.901")));
> 
> pdu.setType(PDU.GETBULK);
> 
> pdu.setNonRepeaters(0);
> 
> pdu.setMaxRepetitions(10);
> 
> 
> response = snmp.send(pdu, target);
> 
> 
> if (response.getResponse() == null) {
> 
> // request timed out
> 
> System.out.println("Requested Timed out");
> 
> }
> 
> else {
> 
> System.out.println("Received response from: "+response.getPeerAddress());
> 
> // dump response PDU
> 
> System.out.println(response.getResponse().toString());
> 
> 
> responsePDU = response.getResponse();
> 
> 
> vb = responsePDU.getVariableBindings();
> 
> System.out.println("Size: "+vb.size());
> 
> Iterator iter = vb.iterator();
> 
> while(iter.hasNext()){
> 
> VariableBinding v = (VariableBinding) iter.next();
> 
> System.out.println(v.getOid()+"\n"+v.getVariable().toString());
> 
> 
> 
> }catch(IOException e){
> 
> System.out.println("<Main Error: "+e);
> 
> }
> 
> 
> }//main()
> 
> }//client
> 
> 
> 
> 
> 
> Regards,
> 
> 
> 
> Ricardo Bandeira
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list