JMX Plugin
This plugin adds JMX MBeanServer support through spring and configures a number MBeans.
NOTE: This is still is an early release.
Plugin features:
- Configures MBeanServer in Grails Application
- Exposes Log4j for runtime logging level configuration
- Exposes the Grails DataSource
- Exposes Any Service configured for jmx
- Allows other Spring beans to be configured for jmx
Full source code is available at git://github.com/kensipe/jmx-grails-plugin.git
Setup
grails install-plugin jmx
There is nothing to do after the install if you have no services to expose. Just run the application and use jconsole to administrate.
However to be able to connect to the exposed services (which also includes the ones made available by the plugin by default) you have to set the system property
com.sun.management.jmxremote before running your app.
Exposing Services
By default, the plugin only supports exposing Services. This is accomplished by add 'jmx' to the static expose property as outlined below:
class StateService { boolean transactional = true
static expose = ['jmx']
This will expose the service leverage a convention for the service name. Alternatively you can be very explicit on the object through the following example:
class CountryService { boolean transactional = true
static expose = ['jmx:service=Country,type=special']Exposing Spring Beans
The plugin also supports exposing other Spring Beans - e.g. registered via
resources.groovy . This is accomplished by adding 'jmx' to the static expose property as outlined above and using the following code in
Config.groovy -
grails {
jmx {
exportBeans = ['myBean']
}
}
Future plans
- Check for proper ObjectName
- Expose Jetty Services
Release Notes
v.0.3: First released into the wild.
Questions
Contact kensipe@gmail.com