I would like to get the interface information for the snmp GETBULK router, but when I use it, only parts of the record are returned.
Code below:
public static void main(String[] args) throws IOException, InterruptedException { Snmp snmp = new Snmp(new DefaultUdpTransportMapping()); snmp.listen(); CommunityTarget target = new CommunityTarget(); target.setCommunity(new OctetString("public")); target.setVersion(SnmpConstants.version2c); target.setAddress(new UdpAddress("127.0.0.1/161")); target.setTimeout(3000); //3s target.setRetries(1); PDU pdu = new PDU(); pdu.setType(PDU.GETBULK); pdu.setMaxRepetitions(200); pdu.setNonRepeaters(0); pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.31.1.1.1.1"))); ResponseEvent responseEvent = snmp.send(pdu, target); PDU response = responseEvent.getResponse(); if (response == null) { System.out.println("TimeOut..."); } else { if (response.getErrorStatus() == PDU.noError) { Vector<? extends VariableBinding> vbs = response.getVariableBindings(); for (VariableBinding vb : vbs) { System.out.println(vb + " ," + vb.getVariable().getSyntaxString()); } } else { System.out.println("Error:" + response.getErrorStatusText()); } } }
After completing this process, 59 records are returned, but if I use GETNEXT to retrieve them, about 197 records are returned.
Any ideas?
Hope someone can help me, thanks in advance.
source share