Chapter 12. Management and Monitoring

12.1. Configuration
12.1.1. MBeanServer Creation / Finding Strategy
12.1.2. Remote JMX Adaptor
12.1.3. kodo.MBeans Property
12.1.4. Local Management
12.1.5. Configuring Logging for Management / Monitoring
12.2. Kodo Management Console
12.2.1. Remote Connection
12.2.1.1. Connecting to Kodo under JBoss 3.2
12.2.2. Using the Kodo Management Console
12.2.2.1. JMX Explorer
12.2.2.1.1. Executing Operations
12.2.2.1.2. Listening to Notifications
12.2.2.2. MBean Panel
12.2.2.2.1. Notifications / Statistics
12.2.2.2.2. Setting Attributes
12.3. Accessing the MBeanServer from Code
12.4. MBeans
12.4.1. Log MBean
12.4.2. Kodo Pooling DataSource MBean
12.4.3. PreparedStatement Cache MBean
12.4.4. Query Cache MBean
12.4.5. Datastore Cache MBean
12.4.6. TimeWatch MBean
12.4.7. Runtime MBean
12.4.8. Profiling MBean

This release of Kodo includes a preview of a management and monitoring API and set of tools. Note that these capabilities are in preview status, and thus are not as mature as the rest of the product. Also, the APIs and tools are likely to change significantly in minor releases.

The management and monitoring capability uses the Java Management Extensions (JMX) standard to allow for both local and remote management of key:

The unit of management in JMX is the Managed Bean (MBean). Kodo provides a number of MBeans that allow management of key components. For example, the connection pool MBean provides statistics on the numbers of active and idle connections, and allows modification of the attributes controlling the maximum number of active connections.

The default JMX implementation used by Kodo is MX4J version 1.1.1 (see mx4j.sourceforge.net). The MX4J jar, mx4j-jmx.jar, is included in the Kodo distribution, and is covered under the MX4J license, which can be found in the lib directory. To use a different implementation, simply remove the mx4j-jmx.jar file from your CLASSPATH and insert the appropriate jars for your JMX implementation.

Note that the resource archive kodo.rar provided with Kodo does not include MX4J. This is because most application servers provide their own JMX implementation. However, a small subset of the MX4J implementation is included.

The management and monitoring capability can be run both locally and remotely. An example of its use can be found in the management sample described in Section 1.13, “JMX Management”.

12.1. Configuration

The Management capability is configured via the standard Kodo configuration system. The configuration properties are discussed in the following sections.

12.1.1. MBeanServer Creation / Finding Strategy

If JMX based management is desired, Kodo needs to either find an existing MBeanServer or create a new one. The configuration property kodo.MBeanServerStrategy allows for configuration of this process. The following options are available:

  • none: Do not create or use an MBeanServer. This is the default.

  • any-create: Attempt to find an existing MBeanServer. If multiple are found, use the first one. If none are found, create a new server.

  • create: Do not attempt to find an existing MBeanServer. Always create a new server.

  • agentId:<agent ID>: Attempt to find an existing MBeanServer with the given agent ID. If such a server is not found, create a new server.

12.1.2. Remote JMX Adaptor

In order to do remote management, a remote JMX adaptor needs to be started. Once the adaptor has started, the GUI needs to be started. See Section 12.2, “Kodo Management Console” for more information. To start up a remote management adaptor, set the kodo.RemoteJMXAdaptor configuration property to mx4j-jrmp. This property is also a plugin string (see Section 2.4, “Plugin Configuration”), so you can also set it to the full class name of a custom RemoteJMXAdaptor. The mx4j-jrmp adaptor sets up an RMI registry naming service on rmi://localhost:1099 and registers an MX4J JRMP JMX adaptor under the JNDI name jrmp.

The mx4j-jrmp adaptor accepts the following properties:

  • JNDIName: The JNDI name under which to register the remote JMX adaptor. Defaults to jrmp.

  • host: The hostname on which the RMI registry naming service will listen. Defaults to localhost.

  • port: The port on which the RMI registry naming service will listen. Defaults to 1099.

For example, to listen on port 2345:

kodo.RemoteJMXAdaptor: mx4j-jrmp(port=2345)

12.1.3. kodo.MBeans Property

The kodo.MBeans property is a plugin list string (see Section 2.4, “Plugin Configuration”) indicating which com.solarmetric.manage.jmx.MBeanProvider classes to use to create MBeans for registration, if any. Common values are:

  • none: Do not register additional MBeans. This is the default.

  • log: Indicates that the LogMBean should be registered.

  • runtime: Indicates that the RuntimeMBean should be registered.

For example, to register both the RuntimeMBean and the LogMBean:

kodo.MBeans: runtime, log

12.1.4. Local Management

To start up a local management and monitoring graphical user interface (GUI), set the kodo.JMXInterface property to gui. This property is also a plugin string (see Section 2.4, “Plugin Configuration”), so you can also set it to the full class name of a custom JMXInterface.

12.1.5. Configuring Logging for Management / Monitoring

Logging for the management and monitoring API is on the com.solarmetric.Manage logging channel.