[SNMP4J] [SNMP4j] How to determine the correct maxNumOfRowsPerPDU in tableUtils

Tongjie Li snow8261 at gmail.com
Thu Apr 3 07:11:35 CEST 2014


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



-- 
All the Best!
Li Tongjie



More information about the SNMP4J mailing list