[SNMP4J] RE Agent request listener
Frank Fock
fock at agentpp.com
Thu Jul 10 23:37:16 CEST 2008
Hi Mathieu,
I do recommend this approach. SNMP4J-Agent
is a complete framework and handles a lot
of stuff for you. Using the approach below,
you will have to rewrite 70% of the SNMP4J-Agent
code - which is a lot.
You can read the SNMP4J-Agent instrumentation
how-to PDF coming with AgenPro for other
approaches.
Best regards,
Frank
mathieu carrolle wrote:
> Hello,
> I found the solution so i post it for helping people :
>
> public static void main(String[] args) {
> String address = "127.0.0.1/4700";
> BasicConfigurator.configure();
>
> try {
> CopyOfAgent testAgent1 = new CopyOfAgent(new File(
> "SNMP4JTestAgentBC.cfg"), new File(
> "SNMP4JTestAgentConfig.cfg"));
> ........
> //Add the listenner
> testAgent1.getSession().addCommandResponder(new MORequestListener());
> ....
>
> Now you implement the interface RequestStatusListenner :
>
> public class MORequestListener implements MOChangeListener, RequestStatusListener, CommandResponder {
> @Override
> public void processPdu(CommandResponderEvent event) {
>
> PDU pdu = event.getPDU();
> if(pdu.getType()==PDU.GET){
> System.out.println(event.toString());
> }
> }
> }
>
> Bye
>
>> From: mathieu.carrolle at hotmail.fr
>> To: snmp4j at agentpp.org
>> Date: Thu, 10 Jul 2008 12:04:51 +0200
>> Subject: [SNMP4J] RE Agent request listener
>>
>>
>> Hello,
>>
>> I try the snmp4j TestAgent.java exemple.
>> When a request is doing by a manager, for exemple :
>> "snmpget -v 1 -c public <mysnmpagent_address> enterprises.4890.1.1.0"
>> In my agent how can get the content of the request (oid, type of command ...) ?
>>
>> Sorry for my poor english.
>> Thanks
>
> _________________________________________________________________
> Votre contact a choisi Hotmail, l'e-mail nouvelle génération. Créez un compte.
> http://www.windowslive.fr/hotmail/default.asp_______________________________________________
> 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
More information about the SNMP4J
mailing list