Hi, Using GETNEXT instead of GETBULK is not the solution, of course. You can set maxRepetitions to 1000 if you like. 10.000 would be OK too. The agent will then provide as much rows as the agent can. In either case, the agent will has to provide all rows it has.
In your case, the agent seems to have a bug or the table content (i.e., the number of rows) changes often. Best regards, Frank Am 05.04.2014 08:36, schrieb Tongjie Li:
Hi Frank Thanks for your answer.If we can not know the suitable value of maxRepetitions of getBulk function, how can we use getBulk in a production environment? So we have to use getNext instead of getBulk in production? Since we have a lot of device need to be monitor by snmp, getNext isn't very efficiency. I changed pdu.getBulk to pdu.getNext in the example, but I found the result table size is 1512 records, and it is also less than the getBulk with maxRepetitions set to 20 which is 1528 records. public List snmpGetTable(OID[] columnOIDs, OID lowerBoundIndex, OID upperBoundIndex) throws IOException {List result = null;TableUtils tableUtils = new TableUtils(this.snmp, new DefaultPDUFactory(PDU.GETNEXT));tableUtils.setMaxNumRowsPerPDU(maxRepetitions);result = tableUtils.getTable(this.comtarget, columnOIDs, lowerBoundIndex, upperBoundIndex);return result; } How can we get it right? How to get all rows of a table correctly? Thank you very much. Best Regards,On Thu, Apr 3, 2014 at 10:33 PM, Frank Fock <[email protected] <mailto:[email protected]>> wrote:Hi, There is no "correct" maxRepetitions. Any value is "correct". The agent decides how many repetitions it will provide based on local contraints and measures. Some agent never return more than one, others up to the maximum packet size, others by timing constraints. Thus, you can never know how many repetitions there will be returned. BTW, OIDs do NOT start with a dot character. Simply write new OID("1.3.6.1.2.1.47.1.1.1.1.1") Best regards, Frank Am 03.04.2014 07:11, schrieb Tongjie Li: Hi everybody I was executing a getTable in snmp4j on entitymib. I defined the following columns like following sample code public static OID[] getColumnOIDs() { if (equipmentColumns != null) return equipmentColumns; equipmentColumns = new OID[11]; equipmentColumns[0] = new OID(".1.3.6.1.2.1.47.1.1.1.1.1"); //entPhysicalIndex equipmentColumns[1] = new OID(".1.3.6.1.2.1.47.1.1.1.1.2"); //entPhysicalDescr equipmentColumns[2] = new OID(".1.3.6.1.2.1.47.1.1.1.1.3"); //entPhysicalVendorType equipmentColumns[3] = new OID(".1.3.6.1.2.1.47.1.1.1.1.4"); //entPhysicalContainedIn equipmentColumns[4] = new OID(".1.3.6.1.2.1.47.1.1.1.1.5"); //entPhysicalClass equipmentColumns[5] = new OID(".1.3.6.1.2.1.47.1.1.1.1.6"); //entPhysicalParentRelPos equipmentColumns[6] = new OID(".1.3.6.1.2.1.47.1.1.1.1.7"); //entPhysicalName equipmentColumns[7] = new OID(".1.3.6.1.2.1.47.1.1.1.1.13"); //entPhysicalModelName equipmentColumns[8] = new OID(".1.3.6.1.2.1.47.1.1.1.1.14"); //entPhysicalAlias equipmentColumns[9] = new OID(".1.3.6.1.2.1.47.1.1.1.1.16"); //entPhysicalFru if is fixed equipmentColumns[10] = new OID(".1.3.6.1.2.1.47.1.1.1.1.11");//entPhysicalSerialNum return equipmentColumns; } when I using it with getTable in the snmp4j with following code ( the columnOIDs are equipmentColumns from above example) public List snmpGetTable(OID[] columnOIDs, OID lowerBoundIndex, OID upperBoundIndex) throws IOException { List result = null; TableUtils tableUtils = new TableUtils(this.snmp, new DefaultPDUFactory(PDU.GETBULK)); tableUtils.setMaxNumRowsPerPDU(maxRepetitions); result = tableUtils.getTable(this.comtarget, columnOIDs, lowerBoundIndex, upperBoundIndex); return result; } When i test it,I found that setting different maxRepetitions will get different answers. When I set maxRepetitions to 4 ,it return total number of 1428 records. When I set maxRepetitions to 10, it return total number of 1518 records. When set to 20,it return total number of 1528 records. It made me very crazy. I want to know why and how to set the right maxRepetitions in order to avoid this. It seems that different types of device need to set different maxRepetitions. Is there a way to calculate the correct maxRepetitions ? Best regards-- ---AGENT++ Maximilian-Kolbe-Str. 10 73257 Koengen, Germany https://agentpp.com Phone: +49 7024 8688230 <tel:%2B49%207024%208688230> Fax: +49 7024 8688231 <tel:%2B49%207024%208688231> _______________________________________________ SNMP4J mailing list [email protected] <mailto:[email protected]> https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j -- All the Best! Li Tongjie
-- --- AGENT++ Maximilian-Kolbe-Str. 10 73257 Koengen, Germany https://agentpp.com Phone: +49 7024 8688230 Fax: +49 7024 8688231 _______________________________________________ SNMP4J mailing list [email protected] https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j
