Java Dynamic Management Kit 4.2 Tutorial

Running the AsyncManager Example

If you have not done so already, launch the simple SNMP agent in examplesDir/Snmp/Agent, after making sure that no other agent is running on port 8085. This manager also uses the OID table description (the SnmpOidTableSupport class) that we generated from the MIB for the synchronous manager. If you have not already done so, see "Running the SyncManager Example" for instructions on how to do this.

If you do not have an SNMP agent still running, make sure that no other agent is running on port 8085 and launch one with the following command:


$ cd examplesDir/Snmp/Agent
$ java -classpath classpath Agent nbTraps

Specify the number of traps to be sent to the manager in the nbTraps parameter. Wait until the manager is started to send the traps.

In another terminal window, launch the manager application to connect to this agent. If you wish to run the manager on a different host, replace localhost with the name of the machine where you launched the agent.


$ cd examplesDir/Snmp/Manager
$ java -classpath classpath AsyncManager localhost 8085

You should then see the output of the SnmpWalkUntil request: the response handler method is called for each variable that is returned.

Press <Enter> in the agent's window to send traps and see the trap reports as they are received in the manager. When you are finished with the agent, don't forget to stop it by typing <Control-C> in its terminal window.