[SNMP4J] a multithread approach

Frank Fock fock at agentpp.com
Sun Feb 26 23:59:53 CET 2006


Hello Stefan,

Please find my comments inline:

Stefan M wrote:
>
>   I want to monitor a set of 1000 wlan access points and wrote a little 
> visualisation for this. Now I want to connect this visualisation with 
> the snmp data and I want to know if my approach is correct.
> 
> To retrieve the data:
> 
> 1. I create one intance of an snmp class during program start like so:
> Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
> 
OK.

> 2. I send the pdu as asynchronous message like so:
> snmp.send(pdu, target, null, new RespListener());
> 
> Therein RespListener() is a class wich implements the ResponseListener 
> interface.
OK, but see below.
> 
> 3. I set snmp to listen like so:
> snmp.listen();

You need to do step 3 before step 2. Otherwise you will
not receive any or at least not all responses.

> 
> I would do the step 2 for every access point I have (and for every OID I 
> want to know about). And then I would do step 3. Is this correct? It 
> works for one access point but would it work for 1000?
For 1000 targets it can work too. However, it would be wise
to implement some delay, so that not all responses come in
at the same time (to avoid UDP buffer overflow).
> 
> How can I determine then, which access point send the answer? Do I need 
> to remember the request id or is there a way to retrieve the ip? Is 
> there a standard way to do it...
The ResponseEvent object contains all you need (getPeerAddress()).
> 
> Another question: Is there a way to emulate an snmp agent that answers 
> my requests (to test) -- i.e. is this the purpose of snmp4jagent?
You can use SNMP4J-Agent for that in conjunction with
many alias IP addresses.

Best regards,
Frank

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




More information about the SNMP4J mailing list