Java - Java Management eXtensions (JMX) API

What is JMX?

JMX (Java Management Extensions) is a Java technology that supplies tools for managing and monitoring resources such as:

  • applications,
  • system objects (user, service, ?),
  • devices,
  • service-oriented networks,
  • and the JVM (Java Virtual Machine).

Because JMX technology is dynamic, you can use it to monitor and manage resources as they are created, installed and implemented. You can also use JMX technology to monitor and manage the Java Virtual Machine1 (Java VM).

JMX (Java Management eXtensions) is a technology for:

  • monitoring and managing Java applications.
  • managing systems, networks, and so on.

The API includes remote access, so a remote management program can interact with a running application for these purposes.

Typical uses include:

  • consulting and changing application configuration
  • accumulating statistics about application behavior and making them available
  • notifying of state changes and erroneous conditions.

The fundamental notion of the JMX API is the MBean. An MBean is a named managed object representing a resource.

Articles Related

JSR

JMX technology was developed through the Java Community Process (JCP) as two closely related Java Specification Requests (JSRs):

The Specifications and Reference Implementations can be downloaded at: http://java.sun.com/products/JavaManagement/download.html

Architecture

JSR Tiers Level Description
JSR 3 Java VM Instrumentation Resources, such as applications, devices, or services, are instrumented using Java objects called Managed Beans (MBeans). MBeans expose their management interfaces, composed of attributes and operations, through a JMX agent for remote management and monitoring.
JSR 3 Java VM JMX Agent The main component of a JMX agent is the MBean server. This is a core managed object server in which MBeans are registered. A JMX agent also includes a set of services for handling MBeans. JMX agents directly control resources and make them available to remote management agents.
JSR 160 Remote Remote Management Protocol adaptors and standard connectors make a JMX agent accessible from remote management applications outside the agent’s Java Virtual Machine (Java VM).

Instrumentation

To manage resources using JMX technology, you must first instrument the resources in the Java programming language. You use Java objects known as MBeans to implement the access to the instrumentation of resources.

Once a resource has been instrumented by MBeans, it can be managed through a JMX agent.

In addition, the instrumentation level specifies a notification mechanism. This allows MBeans to generate and propagate notification events to components of the other levels.

The Java Virtual Machine (Java VM) is highly instrumented using JMX technology. You can easily start a JMX agent to access the built-in Java VM instrumentation, and thereby monitor and manage the Java VM remotely by means of JMX technology.

JMX Agent

A JMX agent is a standard management agent that directly controls resources and makes them available to remote management applications.

JMX agents are usually located on the same machine as the resources they control, but this is not a requirement.

The core component of a JMX agent is the MBean server, a managed object server in which MBeans are registered.

A JMX agent also includes a set of services to manage MBeans, and at least one communications adaptor or connector to allow access by a management application.

Remote Management

JMX API instrumentation can be accessed in many different ways, either:

JMX technology provides a standard solution for exporting JMX API instrumentation to remote applications, based on Remote Method Invocation (RMI).

The JMX Remote API specification describes how you can advertise and find JMX agents using existing discovery and lookup infrastructures.

The specification does not define its own discovery and lookup service. The use of existing discovery and lookup services is optional: alternatively you can encode the addresses of your JMX API agents in the form of URLs, and communicate these URLs to the manager.

A management application uses the object name to identify the object on which it is to perform a management operation. The operations available on MBeans include:

  • Discovering the management interface of MBeans
  • Reading and writing their attribute values
  • Performing operations defined by the MBeans
  • Getting notifications emitted by MBeans
  • Querying MBeans based on their object name or their attribute values

JConsole is a readily available JMX client that is included with Sun's Java Developer Kit (version 5 onwards).

How to

Enable JMX

You must enable the use of JMX in your application.

  • To use JMX, you must enable it on your application server, by carrying out the steps under the documentation
  • For stand-alone application, add the startup parameter -Dcom.sun.management.jmxremote
java -Dcom.sun.management.jmxremote -jar jdk_home/demo/jfc/Notepad/Notepad.jar

Java VM

The Java Virtual Machine (Java VM) is highly instrumented using the JMX technology. You can start a JMX agent to access the built-in Java VM instrumentation, and thereby monitor and manage a Java VM remotely.

To monitor and manage different aspects of the Java VM, the Java VM includes a platform MBean server and special MXBeans for use by management applications

Documentation / Reference

  • Bookmark "Java - Java Management eXtensions (JMX) API" at del.icio.us
  • Bookmark "Java - Java Management eXtensions (JMX) API" at Digg
  • Bookmark "Java - Java Management eXtensions (JMX) API" at Ask
  • Bookmark "Java - Java Management eXtensions (JMX) API" at Google
  • Bookmark "Java - Java Management eXtensions (JMX) API" at StumbleUpon
  • Bookmark "Java - Java Management eXtensions (JMX) API" at Technorati
  • Bookmark "Java - Java Management eXtensions (JMX) API" at Live Bookmarks
  • Bookmark "Java - Java Management eXtensions (JMX) API" at Yahoo! Myweb
  • Bookmark "Java - Java Management eXtensions (JMX) API" at Facebook
  • Bookmark "Java - Java Management eXtensions (JMX) API" at Yahoo! Bookmarks
  • Bookmark "Java - Java Management eXtensions (JMX) API" at Twitter
  • Bookmark "Java - Java Management eXtensions (JMX) API" at myAOL
 
language/java/jmx.txt · Last modified: 2013/04/09 14:49 by gerardnico