JBoss.orgCommunity Documentation
The Drools engine supports runtime monitoring through JMX standard MBeans. These MBeans expose configuration and metrics data, from live knowledge bases and sessions, to internal details like rule execution times. Any JMX compatible console can be used to access that data. This chapter details how to use RHQ/JON to do it, but similar steps can be used for any other console.
To enable JMX monitoring in a Drools application, it is necessary to enable remote monitoring in the JVM. There are several tutorials on how to do that in the internet, but we recommend that you check the documentation of your specific JVM. Using the Oracle/Sun JVM, it can be as simple as running the engine with a few command line system properties.
For instance, to enable remote monitoring on port 19988 with disabled authentication (should be only used for tests/demos, as in production authentication should be enabled), just run the application with the following command line parameters:
-Dcom.sun.management.jmxremote.port=19988 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
The second step is to enable the Drools MBeans. As any Drools configuration, that can be done by setting a system property, or adding the property to a configuration file, or using the API.
To enable it in the command line, use:
-Ddrools.mbeans=enabled
To enable id using the API, use:
KieBaseConfiguration conf = ...
conf.setOption( MBeansOption.ENABLED );
The following sequence of steps can be used to configure JON to monitor a Drools application:
Download the JON server and agent.
Download Drools plugin included in the "Drools and jBPM tools" bundle (http://www.jboss.org/drools/downloads.html).
Install server, agent, and the plugin.
Check that the server is running, agent is running and plugin is installed.
Execute the drools application [see details in the previous section].
On the agent console, type "discovery" command for the agent to find the drools application, which it will find on port 19988.
On JON console, click on auto-discovery queue.
Select the JMX Server process that is showing there, running on port 19988.
Click import.
Click on Resources->servers.
Click on the JMX Server.
Under JMXServer on the left hand side, you have Drools Service.