From the mib or website I know that the table have 21 columns,but when I use snmp4j to query the table,I can only query five oids.If I add another oid,the result will be null.What’s the problem?How to fix it?The snmp4j version is 2.8.7. The code is here:
Snmp snmp = SnmpComunication.getSession(1);
Target target = SnmpComunication.getSnmpTarget(snmp, snmpTarget);
TableUtils tableUtils = new TableUtils(snmp, new DefaultPDUFactory(PDU.GET));
OID[] columns = new OID[oids.size()];
for (int i = 0; i < oids.size(); i++) {
columns[i] = new OID(oids.get(i));
}
List events = tableUtils.getTable(target, columns, null, null);
That is most likely a bug in the agent. What is the error status the agent returns (if any)?
If the agent does not return a error status, then it is a bug of the agent (as work around you can still proceed in many cases with the below workaround)
If it returns tooBig error, then you will not be able to request more than 5 columns with a single PDU. Then use TableUtils.setMaxNumColumnsPerPDU to limit the number of columns in a single PDU to 5.