[SNMP4J] Getting Table value from Java code generated by AgenPro2.5

Frank Fock fock at agentpp.com
Tue Dec 5 12:50:31 CET 2006


Padma,

The code that actually returns the values is
already there (in the SNMP4J-Agent API).

What you need to fix is the following:

// This code *only* creates the row:
MOTableRow row = createRow(new OID("1"), values);
// Then actually add it to the table:
addRow(row);

Best regards,
Frank

padma.patruni at cmcltd.com wrote:
> Frank,
> 
> I read your comments. What is the code that I should add to return the
> table values? Can you send the sample code or an example?
> 
> Thanks
> - Padma
> 
>> Hi Padma,
>>
>> I think the problem is basically a simple misunderstanding.
>> Please find my comments below:
>>
>> padma.patruni at cmcltd.com wrote:
>>> Hello Frank,
>>> I have a table entry in the MIB. I created a Class crindEntry which
> extends DefaultMOTable. When I send GET message from MIB Explorer PDU
> tab
>>> for crindEntry it does not go into the get() method of the class. But when
>>> I send GET message for the column object it goes into the get() method of
>>> the class.
>> The PDU panel of MIB Explorer sends GET requests by default.
>> Since a GET on a xxxEntry conceptual table row node will
>> never be successful (the index cannot be a zero length OID),
>> SNMP4J-Agent will not call the get(..) method.
>>
>>> Where should I instrument the code to return the table entry values? I am
>>> sending portions of the MIB file and java code below. I am also attaching
>>> the .java file.
>>> Thanks
>>> - Padma
>> ...
>>>  public class crindEntry extends DefaultMOTable {
>>> 	  crindEntry(OID oid, MOTableIndex idx, MOColumn[] columns,
>>> MOTableModel
>>> model) {
>>>     super(oid, idx, columns, model);
>>>     MOMutableTableRow row;
>>>     Variable[] values = new Variable[6];
>>>     values[0] = new Integer32(11);
>>>     values[1] = new Integer32(12);
>>>     ...
>>>     createRow(new OID("1"), values);
>>>   }
>>>   public void get(SubRequest req)
>>>   {
>>>     System.out.println("------MOTable.get---------");
>>>     System.out.println("------MOTable.getIndex = "+req.getIndex());
>> Caution! The sub-request index you get with req.getIndex()
>> has nothing to do with the row index of your table!
>>
>> Best regards,
>> Frank
>>
>>> System.out.println("------MOTable.get---------");
>>>     super.get(req);
>>>   }
>>>> Hi Padma,
>>>> The How-To provides currently only an example. The
>>>> description will be completed and released 8th
>>>> January 2007.
>>>> Have you checked the example in the How-To? There are
>>>> additional examples contained in SNMP4J-Agent itself.
>>>> What are you trying to accomplish?
>>>> What do you think is not working?
>>>> Best regards,
>>>> Frank
>>>> padma.patruni at cmcltd.com wrote:
>>>>> Hi,
>>>>> I need help and sample code for instrumenting the java code for Table
>>> entry. The java code is generated with AgenPro2.5 but the table entry
> is
>>>>> not working. I am connecting to the Java Agent with MIB Explorer and
>>> want
>>>>> to retrive table values.
>>>>> I checked SNMP4j-Agent-Instrumentation-HowTo.pdf but it does not give
>>> example for table entry.
>>>>> Thanks
>>>>> - Padma
>>>>> DISCLAIMER
>>>>> “The information contained in this e-mail message and/or
> attachments
>>> to it may contain confidential or privileged information. If you are
> not
>>>>> the intended recipient, any dissemination, use, review, distribution,
>>> printing or copying of the information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If you have received
> this communication in error, please notify us by reply e-mail or
> telephone and immediately and permanently delete the message and any
> attachments. Thank you"
>>>>> _______________________________________________
>>>>> SNMP4J mailing list
>>>>> SNMP4J at agentpp.org
>>>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>>> --
>>>> AGENT++
>>>> http://www.agentpp.com
>>>> http://www.mibexplorer.com
>>>> http://www.mibdesigner.com
>>> DISCLAIMER
>>> “The information contained in this e-mail message and/or attachments
> to it may contain confidential or privileged information. If you are
> not
>>> the intended recipient, any dissemination, use, review, distribution,
> printing or copying of the information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If you have received
> this communication in error, please notify us by reply e-mail or
> telephone and immediately and permanently delete the message and any
> attachments. Thank you"
>> --
>> AGENT++
>> http://www.agentpp.com
>> http://www.mibexplorer.com
>> http://www.mibdesigner.com
>>
>>
> 
> 
> 
> 
> 
> DISCLAIMER
> 
> “The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you"

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list