The JavaTM Dynamic Management Kit (Java DMK) 5.1 provides a set of Java classes and tools for developing dynamic management solutions. This product conforms to the Java Management Extensions (JMX), v1.2 Maintenance Release, and the JMX Remote API, v1.0. These specifications define a three-level architecture:
Instrumentation of resources
Dynamic agents
Remote management applications
The JMX architecture is applicable to network management, remote system maintenance, application provisioning, and the management needs of the service-based network.
Once you are familiar with management concepts, the Java Dynamic Management Kit 5.1 Tutorial is intended to demonstrate each of the management levels and how they interact. The parts of this tutorial will show you:
The different ways of making your resources manageable
How to write an agent and add management services dynamically
How to access your resources from a remote management application
The mechanism used to forward events and exceptions from agent to manager
Taken as a whole, these topics will demonstrate the complete development process for implementing a management solution in the Java programming language.
This book also features a part devoted to the details of programming simple network management protocol (SNMP) managers and agents (peers) using the Java DMK.
The following are the main changes and additions to Java DMK since the 5.0 release:
Instrumentation and Agent services compatible with the latest JMX 1.2 Maintenance Release.
Secure and interoperable remote access compatible with the new JMX Remote API 1.0 Specification, including support for both the RMI-based and JMXMP-based standard connectors (see Chapter 9, Protocol Connectors).
Flexible authentication and privacy based on the Simple Authentication and Security Layer (SASL) 1.1 Specification and TLS (see Chapter 11, Connector Security).
SASL mechanisms providing authentication: SASL-PLAIN, DIGEST-MD5, CRAM-MD5, and GSSAPI/Kerberos (see 11.4.2 SASL Provider).
SASL mechanisms providing connection privacy: DIGEST-MD5 and GSSAPI/Kerberos (see 11.4.1 SASL Privacy).
Fine-grained access control based on an authenticated client (see 11.3 Fine-Grained Security).
Wrapping of existing Java DMK 5.0 RMI and HTTP(S) connectors such that applications based on the standard JMX Remote API can interoperate with existing Java DMK-based applications (see 9.5 Wrapping Legacy Connectors).
Enhanced Cascading service, supporting both the JMX Remote API connectors and the legacy Java DMK connectors (see Chapter 14, Cascading Service).
Enhanced Discovery service, allowing the discovery of Java DMK based applications using legacy connectors as well as those using the new connectors (see Chapter 15, Discovery Service).
This tutorial is for developers who would like to learn how to instrument new or existing resources for management, write dynamic agents, or write management applications. You should be familiar with Java programming. Some tutorials also rely on system and network management concepts: knowledge of these is helpful, though not required.
This book is not intended to be an exhaustive reference. Management concepts and product features are covered in the Java Dynamic Management Kit 5.1 Getting Started Guide, and the complete API documentation generated by the JavadocTM tool are provided in the online documentation package.
To build and run the sample programs in this tutorial or use the tool commands provided in the Java DMK, you must have a complete installation of the product on your system. Before programming with the Java DMK you should be familiar with the concepts and tools used throughout this tutorial.
The Java DMK documentation set includes the following documents:
Book Title |
Part Number |
---|---|
Java Dynamic Management Kit 5.1 Installation README |
N/A |
816–7607 |
|
816–7609 |
|
816–7608 |
|
Java Dynamic Management Kit 5.1 Release Notes |
N/A |
These books are available online after you have installed the Java DMK documentation package. The online documentation also includes the API documentation generated by the Javadoc tool for the Java packages and classes. To access the online documentation, using any web browser, open the home page corresponding to your platform.
Operating Environment |
Homepage Location |
---|---|
Solaris / Linux / Windows 2000 |
installDir/SUNWjdmk/5.1/doc/index.html |
In these file names, installDir refers to the base directory or folder of your Java DMK installation. In a default installation procedure, installDir is as follows.
/opt on the Solaris or Linux platforms
C:\Program Files on the Windows 2000 platform
These conventions are used throughout this book whenever referring to files or directories that are part of the installation.
The Java Dynamic Management Kit relies on the management architecture of two Java Specification Requests (JSRs): the JMX specification (JSR 3) and the JMX Remote API specification (JSR 160). The specification documents and reference implementations of these JSRs are available at:
http://java.sun.com/products/JavaManagement/download.html
The structure of this book is based on the The Java Tutorial:
Online version:http://java.sun.com/docs/books/tutorial/
Paperback reference:The Java Tutorial Third Edition by Mary Campione, Kathy Walrath and Alison Huml; book and CD-ROM edition (December 2000); Addison-Wesley Pub. Co.; ISBN: 0201703939
Some chapters in the part on SNMP refer to RFC standards for further information. The complete text of RFC papers can be found on the Internet site of the Internet Engineering Task Force:
Disclaimer – This site is in no way affiliated with Sun Microsystems, Inc. and Sun makes no claim as to the accuracy or relevance of the data it contains.
These tutorials are based on the example programs shipped with the Java DMK. Each example is a set of Java source code files in a separate subdirectory. The following table gives the location of the main examples directory:
Operating Environment |
Examples Directory |
---|---|
Solaris / Linux / Windows 2000 |
installDir/SUNWjdmk/5.1/examples |
Within the examples directory, the examples themselves are separated into two sub-directories: legacy and current. This is to make a clear distinction between the examples that demonstrate the older implementations of features that have been superseded by the implementation of JMX Remote API in Java DMK 5.1. The implementations of features that have been deprecated in Java DMK 5.1 are now held in the legacy directory. The examples of the current features are held in current.
Except where noted, the source code in this book is taken from these example programs. However, some code fragments might be rearranged and comments might be changed. Program listings in the tutorials usually simplify comments and omit output statements for space considerations.
On the Solaris platform, you must have root access to write in the installed examples directory. For this reason, it might be necessary to copy all examples to a different location before compiling them. Throughout the rest of this book, we will use the term examplesDir to refer to the directory in which you compile and run the examples.
When either compiling or running the example programs, make sure that your PATH and CLASSPATH environment variables are correctly set to use the Java 2 Platform, Standard Edition (J2SE). In addition, your classpath must also contain the Java archive (JAR) files for the Java DMK runtime libraries, as well as the current directory (.). If you are using J2SE 1.4.x, then you must also include the runtime libraries for JMX and JMX Remote API, as well as other JAR files relating to the Simple Authentication Security layer (SASL) and Secure Sockets Layer (SSL) security mechanisms, should you require them.
The Java DMK runtime library:
SUNWjdmkrt/5.1/lib/jdmkrt.jar
The JMX, JMX Remote API, SASL and SSL runtime libraries:
SUNWjdmk/5.1/lib/jmx.jar
SUNWjdmk/5.1/lib/jmxremote.jar
SUNWjdmk/5.1/lib/jmxremote_optional.jar
SUNWjdmk/5.1/lib/sunsasl.jar
SUNWjdmk/5.1/lib/sasl.jar
SUNWjdmk/5.1/lib/rmissl.jar
The runtime library for the Java DMK tool kit:
SUNWjdmk/5.1/lib/jdmktk.jar
At the time of writing, a Beta release of version 1.5.0 of the J2SE platform is available. The JMX API and the mandatory part of JMX Remote API have been included in J2SE 1.5, so if you are using version 1.5.0 of the J2SE platform, you do not need to add the jmx.jar, jmxremote.jar and SASL libraries to your class path.
For a Solaris or RedHat Linux platform, use the classpath given in Table P–1. For a Windows 2000 platform, use the classpath given in Table P–2.
Table P–1 Classpath for Compiling or Running the Examples on a Solaris or Linux Platform
J2SE Platform Version |
CLASSPATH |
---|---|
1.4.x |
installDir/SUNWjdmk/5.1/lib/jdmkrt.jar: installDir/SUNWjdmk/5.1/lib/jmx.jar: installDir/SUNWjdmk/5.1/lib/jmxremote.jar: installDir/SUNWjdmk/5.1/lib/jmxremote_optional.jar: installDir/SUNWjdmk/5.1/lib/sasl.jar: installDir/SUNWjdmk/5.1/lib/sunsasl.jar: installDir/SUNWjdmk/5.1/lib/rmissl.jar: installDir/SUNWjdmk/5.1/lib/jdmktk.jar:. |
1.5.0 (Beta) |
installDir/SUNWjdmk/5.1/lib/jdmkrt.jar: installDir/SUNWjdmk/5.1/lib/jmxremote_optional.jar:. |
If you installed the software in the default directory on a Solaris or Linux platform, installDir will be /opt.
Table P–2 Classpath for Compiling or Running the Examples on a Windows 2000 Platform
J2SE Platform Version |
Classpath |
---|---|
1.4.x |
installDir\SUNWjdmk\5.1\lib\jdmkrt.jar; installDir\SUNWjdmk\5.1\lib\jmx.jar; installDir\SUNWjdmk\5.1\lib\jmxremote.jar; installDir\SUNWjdmk\5.1\lib\mxremote_optional.jar; installDir\SUNWjdmk\5.1\lib\sasl.jar; installDir\SUNWjdmk\5.1\lib\sunsasl.jar; installDir\SUNWjdmk\5.1\lib\rmissl.jar;. |
1.5.0 (Beta) |
installDir\SUNWjdmk-runtime\lib\jdmkrt.jar: installDir\SUNWjdmk-runtime-jmx\lib\jmxremote_optional.jar:. |
If you installed the software in the default directory on a Windows 2000 platform, installDir will be C:\Program Files
These classpaths assume that you are in the subdirectory of a particular example when compiling or running it. Specify the classpath on the command line of the javac and java tools with the -classpath option. The J2SE platform version must match the version of the javac or java command that you are using.
Throughout the rest of this book, we will use the term classpath in command-line examples to indicate that you must use the classpath indicated in this section. You can also define this classpath in an environment variable according to your platform and omit its definition on the command line.
To use the mibgen tool and the deprecated proxygen tool provided with Java DMK, add the installation binary directory to your environment's path. The following table gives the location of this directory:
Operating Environment |
Binary Directories |
---|---|
Solaris / Linux / Windows 2000 |
installDir/SUNWjdmk/5.1/lib/jdmktk.jar |
This book follows the organization of the The Java Tutorial. Each major part covers a subject and each chapter covers a topic within that subject.
Part I: “Instrumentation Using MBeans” shows various ways of making a resource manageable, using standard MBeans, dynamic MBeans, model MBeans and open MBeans.
Part II: “Agent Applications” demonstrates the functionality of the MBean server at the heart of an agent.
Part III: “Remote Management Applications” shows how a distant manager can access the resources in an agent.
Part IV: “Agent Services” demonstrates the various kinds of management intelligence that can be added dynamically to an agent.
Part V: “SNMP Interoperability” shows how Java agents can also implement SNMP agents, how to write managers, how to implement SNMP security mechanisms, including SNMPv3 security, and how to implement an SNMP master agent.
Part VI: “Legacy Features” describes all the features from previous versions of Java DMK that have been superseded by the inclusion of JMX Remote API, but that have been retained for reasons for backwards compatibility.
The docs.sun.comSM Web site enables you to access Sun technical documentation online. You can browse the docs.sun.com archive or search for a specific book title or subject. The URL is http://www.oracle.com/technetwork/indexes/documentation/index.html.
Sun Microsystems offers select product documentation in print. For a list of documents and how to order them, see “Buy printed documentation” at http://www.oracle.com/technetwork/indexes/documentation/index.html.
The following table describes the typographic conventions used in this book.
Typeface or Symbol |
Meaning |
Example |
---|---|---|
AaBbCc123 |
The names of commands, files, and directories; on-screen computer output |
Edit your .login file. Use ls -a to list all files. machine_name% you have mail. |
AaBbCc123 |
What you type, contrasted with on-screen computer output |
machine-name% su Password: |
AaBbCc123 |
Command-line placeholder: replace with a real name or value |
To delete a file, type rm filename. |
AaBbCc123 |
Book titles, new words, or terms, or words to be emphasized. |
Read Chapter 6 in User's Guide. These are called class options. You must be root to do this. |
The following table shows the default system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.
Shell |
Prompt |
---|---|
C shell prompt |
machine-name% |
C shell superuser prompt |
machine-name# |
Bourne shell and Korn shell prompt |
$ |
Bourne shell and Korn shell superuser prompt |
# |