[SNMP4J] Send SnmpV3 PDU to multiple agents

Tayyab Akram mail.tayyab at gmail.com
Tue Jul 8 17:11:49 CEST 2008


Hi,

I am writing Snmp Manager using snmp4j and I want to use Snmp-Version-3. I
have to send the Send PDU to multiple agents.
I am using below given code to listen for response.

listenAddress = GenericAddress.parse(System.getProperty("snmp4j.listenAddress",
"udp:127.0.0.1/161"));
TransportMapping transport = new DefaultUdpTransportMapping(new
UdpAddress(0));
objSnmp = new Snmp(transport);
USM usm = new USM(SecurityProtocols.getInstance(), new
OctetString(MPv3.createLocalEngineID()), 0);
SecurityModels.getInstance().addSecurityModel(usm);
transport.listen();

And I am sending PDU by simply calling objSnmp.send( pdu, target )...

Now if I want to send PDU to different targets can I use the same objSnmp
(Instance of Snmp class) to send PDU to different agents??

Also I have to add the USM security to the objSnmp (instance of Snmp) to
authenticate Snmp V3 pdu and I am doing it using,

snmp.getUSM().addUser("SecurityName", usmUser);

But my different agents have differnt different security parameters.... If I
use the Snmp object... How can I use different User for different agents..

Also please guide me if I have to use different Snmp class instances for
different agents then.... Can I listen to their response at one place or I
have to start the listener for each agent??

Thanks,
--Tayyab



More information about the SNMP4J mailing list