Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How should an snmp client receive responses from multiple snmp agents?  RSS feed

 
Simon Reeves
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I require to send get requests/ receive responses to several snmp agents from a single client/manager process.
I have implemented client/agent based on below urls:
http://www.jitendrazaa.com/blog/java/snmp/create-snmp-client-in-java-using-snmp4j/ http://www.jitendrazaa.com/blog/java/snmp/creating-snmp-agent-server-in-java-using-snmp4j/

In order to send a request to an agent, the following is carried out for each server:

TransportMapping transport = new DefaultUdpTransportMapping();
snmp = new Snmp(transport);
transport.listen();
...
pdu.setType(PDU.GET);
// communityTarget contains server target address.
ResponseEvent event = snmp.send(pdu, communityTarget, null);

In order to receive responses from the servers, do I require to carry out a separate transport.listen() for each server? or create a new TransportMapping and Snmp object for each server?

If I only need to make 1 listen() call, I don't understand how the client process can know which server returned the response? ...since each time transport.listen() is called, the listening port
address (transport.getListenAddress()) is the same and 1 extra udp port is listed (netstat), i.e. there is only 1 port for multiple servers.

I am intending to poll each server from a different background thread (in order that the polling interval can be configured).

Thank you
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!