5 Using JMX Extensions to Monitor EDQ

This chapter describes theEDQ Java Management Extensions (JMX) interface that can be used to monitor and manage many details of its operation. JMX is a Java technology designed for remote administration and monitoring of Java components

This chapter includes the following topics:

5.1 Understanding JMX Binding

EDQ can use either an internal JMX server or one that is provided in the WebLogic or Tomcat application server. This topic explains how to control which JMX server is used.

  • A default installation of EDQ on Apache Tomcat uses an internal JMX server.

  • A default installation of EDQ on Oracle WebLogic Server uses the JMX tree in the WebLogic Server application server.

The default configuration contains a Remote Method Invocation (RMI) registry, which is used by the EDQ command line interface as well as by JMX clients. The RMI listening port number is specified by the management.port property, defined in the director.properties file. The default is 8090. This property controls access to both the internal JMX Server and the RMI API that is used by the EDQ command line tools.

You can change the JMX configuration as follows:

  • If you do not want to use the command line interface, and you want to have EDQ JMX Beans appear in the Tomcat application server JMX tree (not the internal JMX server), change the management.port property to 0:

    management.port=0

    When management.port is set to zero, the RMI registry does not listen on any port. This means that the internal JMX Server will not be used and that the RMI API will also not be available. The command line tools will therefore not work if management.port is set to 0.

  • If you are using Oracle WebLogic Server, and you want to use the command line interface as well as have EDQ JMX Beans appear in the WebLogic Server JMX tree, add the following property to the director.properties file in the configuration directory. Retain the setting of 8090 for management.port so that the RMI API can be used by the command line tools.

    management.jndiname=java:comp/env/jmx/runtime

5.2 Understanding JMX Bean Naming

The naming scheme used for the EDQ JMX Beans is designed to work well with Jconsole. However, other JMX Clients may require a modified naming scheme.

The names used for the EDQ JMX Beans can be customized by writing and placing an appropriate JavaScript or Groovy file in the configuration directory and setting the management.namemaker.scriptfile property in the director.properties to indicate its existence

5.2.1 Reviewing the Example

This example demonstrates how to modify the default EDQ JMX Bean naming scheme to add a type attribute to the end of the name. The type attribute will be based on the Java Bean class.

  1. Create a file named jmxnames.js in the configuration directory and add the following JavaScript to it:

    /** 
    * Adds a type attribute to the name of a JMX Beans.      
    * 
    * @param beanclass The bean class name    
    * @param domain The domain name   
    * @param names The name strings 
    * 
    * @return The name string 
    */       
    function objectNameFor(beanclass, domain, names) 
    {        
    var type = beanclass == null ? "*" : beanclass.substring(beanclass.lastIndexOf('.') + 1); 
    var out;        
    /*       
    * The names array always has 2 elements. 
    */       
    out = domain + ":" + "component=" + escape(names[0]) + ",name=" + escape(names[1]); 
    for (var i = 2; i < names.length; i++)  
    {        
    var index = i-1  
    out += "," + "name" + index + "=" + escape(names[i]);    
    }        
    return out + ",type=" + type;      
    }        
    
  2. Add the following line to the director.properties file:

    management.namemaker.scriptfile = jmxnames.js

  3. Restart the EDQ application server.

    The JMX Beans will now include a type qualifier at the end of their names.

5.3 Monitoring Real-Time Processes

EDQ is provided with a built-in JMX server that can be used to monitor many aspects of its operation. Many of the objects and resources that make up the EDQ application provide MBeans to the JMX server, including the real-time Web services.

5.3.1 Monitoring the Real-Time Web Service MBeans

Each real-time Web service registers an MBean for its reader and one for its writer in the JMX tree.

Readers are registered at:

Runtime/Data/Buckets/Realtime/Projects/Project Name/readers/Web service name

Writers are registered at:

Runtime/Data/Buckets/Realtime/Projects/Project Name/writers/Web service name

In each case, the path to the MBean includes the name of the Web service that owns it and the project that contains the web service.

Global Web services (those deployed in a .jar file in the oedq_local_home/webservices directory) have a different path name. Simply replace Projects/Project Name in the path above with Global.

The port for the internal JMX server is controlled by the management.port property, defined in the director.properties file.

5.3.2 Monitoring the Real-Time MBeans

A general JMX console, such as JConsole, can be used to interact with MBeans. Each MBean exposes:

  • Attributes, whose values can be read.

  • Operations that can be invoked to perform some action with the MBean.

  • An interface that allows clients to subscribe to notifications of events that occur on the MBean.

The EDQ real-time web service MBeans uses the following attributes:

closetime

The time at which the bucket was last closed.

concurrent

The current number of synchronous requests.

maxConcurrent

The maximum number of concurrent synchronous requests since the bucket was opened.

maxConcurrentMax

The maximum number of concurrent synchronous requests since startup.

messages

The number of messages processed since the bucket was opened.

open

Indicates whether the bucket is open or closed.

openCount

The number of times the bucket has been opened since startup.

opentime

The time when the bucket was last opened.

processtime

The time when the last message was processed.

records

The number of records processed since the bucket was opened.

threads

The number of threads that used the bucket when it was last opened.

totalMessages

The number of messages processed since startup.

totalRecords

The number of records processed since startup.


The EDQ real-time web service MBeans exposes the following operation:

closedown

Shutdown the reader or writer using this bucket.