[SNMP4J] Several Questions from a New User Creating an Agent in snmp4j

Frank Fock fock at agentpp.com
Fri Mar 17 00:52:00 CET 2006


Hi Jason,

Jason Jeffords wrote:
> All,
> 
> I am trying to determine the best way to do the following:
> 
> 1) set the value of previously created MIB objects from within the Agent
>    itself
>    - is there a direct call to change the value given an OID?
>      Or

Yes and no. Each ManagedObject implementation may have its
own method to manipulate data. The MOScalar has the setValue
method and MOTable the MOTableModel, for example.

>    - should I form a PDU and send it into the Agent code even though I am 
>      in the local process?

No.

> 2) If I form the PDU and send it into the local Agent I would like to use
>    the OID values in the MIB generated by the AgentPro2 tool (generating
>    snmp4j code).  However, all constants in the generated MIB are private by
> 
>    default.  How can I reuse these definitions?

Make then public. You can change the Velocity
template used by AgenPro. Version 2.5 of AgenPro
will use a template that generates public constants.

> 3) Is there any way to register for notification of committed object changes
>    from the SNMP layer?  I see the validate and counter change events but
>    don't see a way to register for changes when they are actually committed.
> 

MOChangeListener provides such a concept for DefaultMOTable.

>    For instance, I don't want to register for validation only to have the 
>    commit fail and get rolled back.  I need to know when the set is 
>    successful (so I can notify other modules and apply the changes to 
>    hardware). 

For tables, I would recommend using the MOTableRowEvent
to apply committed changes atomically.

> 
> My architecture looks like the following:
> 
>  CLI      HTTP      SNMP
>    |       |         |
>   SHARED MANAGED OBJECTS
>            |
>  HARDWARE ABSTRATION LAYER
> 
> 
> My goal is to have changes from each of the upper layer protocols manipulate
> the same shared managed objects, which in turn will get/set from the
> hardware abstraction layer.
> 
> Does anyone know the best way to accomplish this?

You may use the SNMP4J classes to hold the data and provide
interfaces to CLI and HTTP by your own. You may also use
a third party representation like MBeans and provide a
(generic) mapping to SNMP4J-Agent.

Best regards,
Frank

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




More information about the SNMP4J mailing list