[SNMP4J] Creating index for adding row to table entry

pradip de pradip.de at gmail.com
Fri Oct 9 20:28:26 CEST 2009


Hi Frank,
As a follow up question to my previous query is it possible to retrieve the
index of a row using a particular column value for that row instance which
could be an OctetString? The reason for this question is that when I want to
remove the entry I would need to know what the index is or a way to generate
it.
thanks,
Pradip

On Fri, Oct 9, 2009 at 10:53 AM, pradip de <pradip.de at gmail.com> wrote:

> Thanks Frank for the quick reply. That was helpful.
>
> best,
> Pradip
>
>
> On Fri, Oct 9, 2009 at 12:00 AM, Frank Fock <fock at agentpp.com> wrote:
>
>> Hi Pradip,
>>
>> The toSubIndex(..) methods of the SMI types
>> are used to form an index OID from SNMP values.
>> It does *not* hash the values. It simply
>> transforms them. For OctetStrings, it uses each
>> characters decimal value as OID sub-identifier.
>>
>> To generate a integer index, you can use:
>>
>> IndexGenerator ig = new IndexGenerator(new Integer32(0));
>> OID nextIndex = ig.nextSubIndex();
>>
>> Regards,
>> Frank
>>
>> pradip de wrote:
>>
>>> Hi,
>>> What is the typical technique for generating an index to add a row in a
>>> table ? What does the OctetString.toSubIndex(boolean) actually do? Does
>>> it
>>> generate a OID index by using some kind of hashing mechanism over the
>>> OCtetString? Should I use an OctetString that I can assume to be unique
>>> for
>>> each row I add and use it to create an index? I have no problem with this
>>> but sometimes it generates a really long OID for that field. How do I get
>>> index values of single integers incremented each time I add a row?
>>> thanks,
>>> Pradip
>>> _______________________________________________
>>> SNMP4J mailing list
>>> SNMP4J at agentpp.org
>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>>
>>
>> --
>> AGENT++
>> http://www.agentpp.com
>> http://www.snmp4j.com
>> http://www.mibexplorer.com
>> http://www.mibdesigner.com
>>
>>
>



More information about the SNMP4J mailing list