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.
I find that in some tiime If I setMaxNumColumnsPerPDU or setMaxNumRowsPerPDU to 50,I can get the total result. If I setMaxNumColumnsPerPDU or setMaxNumRowsPerPDU to 1.I can get less data, Can you explain why ?
That shouldn’t be the case! (At least if you do not stop the retrieval before it finished)
If TableUtils returns less with a different setting if these two parameters the reason is most likely a bug in the agent regarding lexicographic ordering.