[SNMP4J] SNMP agent implementation

Frank Fock fock at agentpp.com
Mon May 18 11:37:02 CEST 2009


Pankaj,

Although you not necessarily need AgenPro to instrument
your agent, it could be helpful to understand the
instrumentation concepts. I suggest reading the
SNMP4J-Agent instrumentation How-To PDF contained in the
AgenPro download.

Best regards,
Frank

Pankaj Arora wrote:
> My requirements are as follows:
> I have a SNMP service running on my machine. I have a MIB which user can
> poll(snmpwalk, snmpget etc) and I need to reply to specific requests.
> For that I am using snmp4j agent implementation which gives an option to
> write an agent to which snmp service can forward the incoming requests.
> I am using the TestAgent implementation provided in the snmp4j-agent
> download as mentioned below. I am looking forward for some help to
> understand how to hook my replies in that agent so that when a request
> comes for particular oid's I can reply in a fashioned manner.
> 
> Thanks a lot for your reply and help.
> Thanks,
> Pankaj Arora
> 
> -----Original Message-----
> From: Senthil Muniswamy [mailto:senthil.muniswamy at gmail.com] 
> Sent: Sunday, May 17, 2009 7:34 PM
> To: Pankaj Arora
> Cc: snmp4j
> Subject: Re: [SNMP4J] SNMP agent implementation
> 
> If your MIB is simple then you can implement the agent without AgenPro.
> 
> Sub-agent? Is that Java application you are referring is an another SNMP
> Agent?
> 
> Could you be clear on your exact requirement?
> 
> 
> On Sun, May 17, 2009 at 10:25 PM, Pankaj Arora <parora at castiron.com>
> wrote:
>> Thanks for the reply.
>> We are registered with IANA and have our Mib's in hand. I also know
>> specific Oid's I have to reply to.
>>
>> I believe that
>> TestAgent.java(snmp4j-agent/src/org/snmp4j/agent/test/TestAgent.java)
>> available as code example in snmp4j-agent implementation has a
> starting
>> point to write an agent. It gives gives a sample implementation of the
>> agent. I am trying to hook my code in this as when I configure SNMP to
>> forward the requests to this sub-agent it reaches here. My aim is to
>> reply to the requests reaching here with right information. I am not
>> sure how to do this. Why I need agentPro here?
>> Can you give some more insight on that?
>> After putting this mail to group I wrote a custom command Responder
> and
>> added it to the TestAgent and now requests are dispatched to my
>> processRequest method in the commandResponder. I am not sure how to
>> construct the right reply for the request. Is there any example on how
>> to prepare the right reply for requests coming in and how to put your
>> text in that reply?
>> Aim is to get some oid's request in the sub-agent and reply in right
>> format and with some custom information.
>>
>> Thanks,
>> Pankaj Arora
>>
>>
>>
>> -----Original Message-----
>> From: Senthil Muniswamy [mailto:senthil.muniswamy at gmail.com]
>> Sent: Friday, May 15, 2009 10:27 PM
>> To: Pankaj Arora
>> Cc: snmp4j
>> Subject: Re: [SNMP4J] SNMP agent implementation
>>
>> Pankaj,
>>
>> All you need is an SNMP Agent implementation and not the Proxy
>> Forwarder.
>>
>> 1) Get familiar with SNMP Protocol & MIBs.
>> 2) Register with IANA for enterprise number if your employer don't
>> have one already.
>> 3) Find out the information that you want to expose from the Java
>> application.
>> 3) Define them in MIBs. Tools like MIB Designer
>> http://www.mibdesigner.com will help you write easily
>> 4) Use AgenPro http://www.agentpp.com/agen/agen.html to generate the
>> SNMP4J code for the MIBs
>> 5) Implement the generated methods i.e. call the Java application
>>
>> HTH.
>>
>> On Fri, May 15, 2009 at 6:38 PM, Pankaj Arora <parora at castiron.com>
>> wrote:
>>> To give more details:
>>> I'm writing a SNMP agent. The agent is getting GET requests from
>>> external
>>> SNMP compliant program. My agent should process the request (using
> the
>>> OID)
>>> and call another external program (written in java) to fetch this
>>> requested
>>> data. Then the agent should return this data to the SNMP compliant
>>> program
>>> which requested the data, using the response process.
>>> I am able to get the request forwarded to the TestAgent provided. I
> am
>>> not able to figure out how to hook responder so that for particular
>>> oid's I can use my code?
>>> Please give me some pointers.
>>>
>>> -----Original Message-----
>>> From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org]
>> On
>>> Behalf Of Pankaj Arora
>>> Sent: Friday, May 15, 2009 10:50 AM
>>> To: snmp4j at agentpp.org
>>> Subject: [SNMP4J] SNMP agent implementation
>>>
>>> Hi,
>>>
>>> I am new to SNMP development. I have a requirement to create a proxy
>>> agent which gets the requests forwarded from SNMP and replies to
> them.
>> I
>>> took the TestAgent example provided in snmp4j-agent package and ran
>> it.
>>> I am at stage where when I do snmpWalk the request are getting
>> forwarded
>>> to the TestAgent class, but I am not sure how to hook my code to
> reply
>>> to those requests. Can anyone of you provide some tutorials or
>>> instructions on how to proceed on this?
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Pankaj Arora
>>>
>>> _______________________________________________
>>> SNMP4J mailing list
>>> SNMP4J at agentpp.org
>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>> _______________________________________________
>>> SNMP4J mailing list
>>> SNMP4J at agentpp.org
>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>>
> _______________________________________________
> 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