In addition to managing Coherence with JMX, Coherence provides the ability to manage and monitor custom MBeans (that is, application-level MBeans) within the Coherence JMX Management and Monitoring framework. This enables you to manage or monitor any application-level MBean from any JVM, node, or end-point within the cluster.
In addition to the standard Coherence managed object types, any dynamic or standard MBean type may be registered using the
Coherence can be configured to load platform and standard MBeans on connection to the cluster. This allows administrators and support personnel to update and view system and application information from all nodes in a cluster from a single location. This feature also eliminates the need for JMX programs to connect to multiple sources to gather information.
The following instructions describe how to add a standard MBean to Coherence:
Create a standard MBean.
Add a standard MBean Class or JAR to the Coherence classpath (including central management node).
Create a custom MBean XML configuration file (see "Creating an MBean XML Configuration File").
Modify node startup scripts to reference
custom-mbean.xml (see "Enabling a Custom MBean Configuration File".
Example 41-1 illustrates sample code that programmatically adds a standard MBean to Coherence.
Registry registry = CacheFactory.ensureCluster().getManagement(); Custom bean = new Custom(); String sName = registry.ensureGlobalName("type=Custom"); registry.register(sName, bean);
Example 41-1 uses the
ensureGlobalName method when adding a custom MBean to Coherence. The method is used to add the
nodeId=... portion to the end of the MBean's
ObjectName. This is required in order to have unique names on the centralized MBean server. If an application requires static MBean names, use a MBean query to add MBeans from a local MBean server to the Coherence management system. This will create the MBeans on the managed node with the static name and then add the
,nodeId=... portion to the name of the MBean when aggregating on the managing node.
To use static MBean names:
Register the MBeans on the local MBean server of the managed node using the
createMBean methods prior to joining the cluster. See the
MBeanServer interface JavaDocs for information on using these methods:
MBeanHelper.findMBeanServer() method to obtain the same MBean server that Coherence is using.
custom-mbeans.xml file to query the newly registered MBeans. See "Configuring JMX MBeans".
Note:Refer to the Sun documentation below to ensure an environment is set up properly to access the local MBean server.
The following instructions describe how to add the results of a JMX query to Coherence.
Create a custom MBean XML file (see "Creating an MBean XML Configuration File").
Configure node startup script to include JMX MBean Server
Configure a node startup script to reference
custom-mbean.xml (see "Enabling a Custom MBean Configuration File").
Figure 41-1 illustrates an example of running a JMX Query in JConsole.