| [[_rhqchapter]] |
| = JMX monitoring with RHQ/JON |
| |
| == Introduction |
| |
| |
| 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. |
| |
| === Enabling JMX monitoring in a Drools application |
| |
| |
| 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: |
| |
| [source,xml] |
| ---- |
| -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: |
| |
| [source,xml] |
| ---- |
| -Dkie.mbeans=enabled |
| ---- |
| |
| |
| To enable id using the API, use: |
| |
| [source,xml] |
| ---- |
| KieBaseConfiguration conf = ... |
| conf.setOption( MBeansOption.ENABLED ); |
| ---- |
| |
| === Installing and running the RHQ/JON plugin |
| |
| |
| 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 (https://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. |