The Sample JDMK Java SNMP Manager


Evaluation copies of the JDMK toolkit can be downloaded from Sun Microsystems' Web site [SunMicrosystems]. Included with JDMK is a rich mix of sample Java programs that use the internal class library. In this section, we describe a handcrafted program that uses JDMK to implement the following SNMP requests :

  • GetRequest

  • GetNext

In effect, this is a cutback version of our earlier Visual C++ program. JDMK programs can interact with either the JDMK sample agent provided by Sun or with any other legacy agent. To illustrate this interoperability, we use the standard Windows 2000/NT SNMP agent as the target of our JDMK SNMP Get/GetNext messages (rather than using the JDMK sample agent). This is an interesting illustration of the mature and standard nature of SNMP technology in general. The full source code for the Java program is located in Appendix B, "Some Simple IP Routing Experiments."

Just as for the C++ sample, we provide companion DOS batch files to simplify use of the program.

Installing JDMK

A number of Sun Microsystems' software applications are needed for our Java example. The following installation steps were followed (for Windows NT) in order to set up JDMK:

  1. Install the Java Development Kit (JDK) : We used the Java 2 SDK Standard Edition v1.3.1_02.

  2. Install JDMK : We used JDMK 4.2 for JDK 1.1.8.

  3. Install JDMK : We used JDMK 4.2 for Java 2 Platform.

Step 2 may not be necessary.

Installation of JDMK involves running two downloaded batch files called Setup.bat this extracts the JDMK class files ( jdmk42_nt_12.class and jdmk42_nt_11.class , respectively).

Next, the environment variables must be set. We created one variable ( JDMKPATH ) and modified two others for this:

  1. JDMKPATH

  2. The system PATH

  3. The Java CLASSPATH

The values we assigned to these variables are:

[View full width]
 
[View full width]
JDMKPATH=C:\Program Files\SUN\Wjdmk\jdmk4.2.2 PATH=%JDMKPATH%\bin;C:\jdk1.3.1_02\bin CLASSPATH=%JDMKPATH%\lib\collections.jar;%JDMKPATH%\lib\jdmkrt.jar;%JDMKPATH%\lib\jdmktk. graphics/ccc.gif jar;.

The syntax %JDMKPATH% is simply a shorthand form for the fully expanded contents of JDMKPATH . One last point is to make sure to include the period (for the current directory) at the end of the CLASSPATH .

Last Steps in the Setup

To use the NT SNMP agent, make sure to apply NT Service Pack 6a. Also, ensure that the SNMP agent has two configured community strings (the Visual C++ program used just one community string):

  • public (read-only)

  • private (read-write)

It should be possible to successfully run the examples once these steps have been taken. Please note that the two managers were run only on a Windows NT Workstation (Version 4.00 Build 1381) with Service Pack 6a. Windows 2000 was used only for the agent.



Network Management, MIBs and MPLS
Network Management, MIBs and MPLS: Principles, Design and Implementation
ISBN: 0131011138
EAN: 2147483647
Year: 2003
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net