Sun Microsystems
Products & Services
 
Support & Training
 
 

Previous Previous     Contents     Index     Next Next

20.7.4 Running the SNMP Master Agent Examples

Before running the example applications, compile all the Java classes in each of the four subdirectories inside examplesDir/current/Snmp/MasterAgent, by typing the following command in each directory.

$ javac -classpath classpath -d . *.java

The following procedures give instructions to run five different SNMP master agent scenarios:

  • The manager sends requests to the master agent with an SNMPv2 subagent.

  • The manager sends requests to the master agent with an SNMPv3 subagent.

  • The manager sends requests to the master agent, with overlapping.

  • The manager receives forwarded SNMPv1 and SNMPv2 traps. Both the agent and manager must be running on the same host.

  • The manager receives forwarded SNMPv3 traps.

Ensure that no agents are already running before you start the examples.

ProcedureTo Send Requests From a Manager to the SNMPv2 Master Agent

Because there are no MIBs overlapping in this first example, all the variables implemented by the subagent MIB can be seen from the manager. Thus, you can see that some of the OIDs queried return a DisplayString value of error#.

  1. Start the StandAloneAgent subagent.

    In examplesDir/current/Snmp/MasterAgent/standalone, type the following command:

    $ java -classpath classpath -Djdmk.security.file=jdmk.security 
    StandAloneAgent 8085

    This binds StandAloneAgent to port 8085. Do not send traps when prompted.

  2. Start the SNMPv2 MasterAgent application.

    You need to provide MasterAgent with the following information:

    • The location of its security configuration file, jdmk.security

    • The port on which it should listen for incoming requests, in this case we choose 8087

    • The subagent's host, in this case the local host

    • The subagent's port number, in this case 8085

    In examplesDir/current/Snmp/MasterAgent/master, type the following command:

    $ java -classpath classpath -Djdmk.security.file=jdmk.security 
    MasterAgent 8087 localhost 8085

    The following output is displayed:

    NOTE: HTML adaptor is bound on TCP port 8082
    NOTE: SNMP Adaptor is bound on UDP port 8087
    The master agent forward traps on port : 8088
    
    >> Press Enter if you want to stop.

  3. Start the SimpleManager application.

    You need to provide SimpleManager with the following information:

    • The location of its security configuration file, jdmk.security

    • The master agent's host, in this case the local host

    • The port on which the master agent is listening for request, in this case 8087

    In examplesDir/current/Snmp/MasterAgent/manager, type the following command:

    $ java -classpath classpath -Djdmk.security.file=jdmk.security 
    SimpleManager localhost 8087
    >> Press Enter if you want to send a SNMPv3 request.

  4. Press Enter to send an SNMPv3 request

    The following output is displayed:

    SimpleManager::main: Send SNMPv3 get request to SNMPv3 agent  
    on localhost at port 8087
    Result: 
    [Object ID : 1.3.6.1.2.1.1.1.0  (Syntax : String)
    Value : error1, Object ID : 1.3.6.1.2.1.1.2.0  (Syntax : String)
    Value : error2, Object ID : 1.3.6.1.2.1.1.3.0  (Syntax : String)
    Value : sysDescr3, Object ID : 1.3.6.1.2.1.1.4.0  (Syntax : String)
    Value : sysDescr4]
    
    >> Press Enter if you want to send a SNMPv2 request.

  5. Press Enter to send an SNMPv2 request

    The following output is displayed:

    SimpleManager::main: Send SNMPv2 get request to SNMP agent 
    on localhost at port 8087
    Result: 
    [Object ID : 1.3.6.1.2.1.1.1.0  (Syntax : String)
    Value : error1, Object ID : 1.3.6.1.2.1.1.2.0  (Syntax : String)
    Value : error2, Object ID : 1.3.6.1.2.1.1.3.0  (Syntax : String)
    Value : sysDescr3, Object ID : 1.3.6.1.2.1.1.4.0  (Syntax : String)
    Value : sysDescr4]
    $

    The manager has successfully sent the two requests to the subagent, via the master agent.

ProcedureTo Send Requests From a Manager to the SNMPv3 Master Agent

Because there is no MIB overlapping in this second example, all the variables implemented by the subagent MIB can be seen from the manager. Thus, you see that some of the OIDs queried return a DisplayString value of error#.

  1. Start the StandAloneAgent subagent.

    In examplesDir/current/Snmp/MasterAgent/standalone, type the following command:

    $ java -classpath classpath -Djdmk.security.file=jdmk.security 
    StandAloneAgent 8085

    This binds StandAloneAgent to port 8085. Do not send traps when prompted.

  2. Start the SNMPv3 MasterAgentV3 application.

    You need to provide MasterAgentV3 with the following information:

    • The location of its security configuration file, jdmk.security

    • The port on which it should listen for incoming requests, in this case we choose 8087

    • The subagent's host, in this case the local host

    • The subagent's port number, in this case 8085

    • The manager's host, in this case the local host

    In examplesDir/current/Snmp/MasterAgent/master, type the following command:

    $ java -classpath classpath -Djdmk.security.file=jdmk.security 
    MasterAgentV3 8087 localhost 8085 localhost

    The following output is displayed:

    NOTE: HTML adaptor is bound on TCP port 8082
    NOTE: SNMP Adaptor is bound on UDP port 8087
    
    >> Press Enter if you want to stop.

  3. Start the SimpleManager application.

    You need to provide SimpleManager with the following information:

    • The location of its security configuration file, jdmk.security

    • The master agent's host, in this case the local host

    • The port on which the master agent is listening for requests, in this case 8087

    In examplesDir/current/Snmp/MasterAgent/manager, type the following command:

    $ java -classpath classpath -Djdmk.security.file=jdmk.security 
    SimpleManager localhost 8087
    >> Press Enter if you want to send a SNMPv3 request.

  4. Press Enter to send an SNMPv3 request

    The following output is displayed:

    SimpleManager::main: Send SNMPv3 get request to SNMPv3 agent 
    on localhost at port 8087
    Result: 
    [Object ID : 1.3.6.1.2.1.1.1.0  (Syntax : String)
    Value : error1, Object ID : 1.3.6.1.2.1.1.2.0  (Syntax : String)
    Value : error2, Object ID : 1.3.6.1.2.1.1.3.0  (Syntax : String)
    Value : sysDescr3, Object ID : 1.3.6.1.2.1.1.4.0  (Syntax : String)
    Value : sysDescr4]
    
    >> Press Enter if you want to send a SNMPv2 request.

  5. Press Enter to send an SNMPv2 request

    The following output is displayed:

    SimpleManager::main: Send SNMPv2 get request to SNMP agent 
    on localhost at port 8087
    Result: 
    [Object ID : 1.3.6.1.2.1.1.1.0  (Syntax : String)
    Value : error1, Object ID : 1.3.6.1.2.1.1.2.0  (Syntax : String)
    Value : error2, Object ID : 1.3.6.1.2.1.1.3.0  (Syntax : String)
    Value : sysDescr3, Object ID : 1.3.6.1.2.1.1.4.0  (Syntax : String)
    Value : sysDescr4]
    $

    The manager has successfully sent the two requests to the subagent, via the SNMPv3 master agent.

Previous Previous     Contents     Index     Next Next