Jmx4Perl provides an alternative way of accessing Java JEE Server management interfaces that are based on JMX (Java Management Extensions). It is an agent-based approach where a small Java Web application (approx. 150k) deployed on the application server provides HTTP/JSON-based access to JMX MBeans registered within the application server. It is set up from a handful of Perl modules, which can be integrated seamlessly in your own Perl programs. It includes a sample Nagios check command utilizing JMX::Jmx4Perl as well as the jmx4perl tool, which allows for access to JMX information via the command line. j4psh is a readline based JMX shell with context sensitive command completion and syntax highlighting.

Benefits of this approach compared to the traditional way of accessing JMX remotely via JSR 160 connectors are:

  • No Java installation required on the Nagios host
  • Fast plugin startup times because no JVM needs to be launched
  • Support for bulk operations
  • Fine grained security policies possible
  • No special JEE Server startup options required in order to access JMX information remotely
  • JSON serialization allows deep access into Java objects
  • Firewall friendly communication via HTTP

Jmx4perl can be operated in a proxy mode where a dedicated proxy server accesses the target platform via JSR-160 JMX remoting. This allows for an agentless operation without the need of installing any extra software on the target server.

Beside these technical advantages, the JMX Nagios Plugin check_jmx4perl provides also a rich feature set:

  • Access to JMX attributes and return values of JMX operations for monitoring purposes
  • Incremental mode for monitoring the velocity of value changes, e.g. the growth rate of the thread count
  • Relative monitoring of values by providing a base value attribute, e.g. for checking that the memory used is below 80% of the available memory
  • Deep access to arbitrary Java bean attributes, e.g. the statistics values of a JSR77 Stats object
  • Alias names for common attributes and operations
  • Selective access to a predefined set of MBeans by providing an access policy file to the agent servlet
  • Configuration via configuration file with a sophisticated syntax, which also allows for multiple JMX checks in one Nagios check (multi-check)

This plugin has been tested on JBoss 4.2.3 GA & 5.1.0 GA, Oracle Weblogic 9.2 MP3 & 10.0.2.0, IBM Websphere 6.1 & 7.0, Jonas 4.10.3 (with Jetty 5.1.10 and Tomcat 5.5.26), Apache Geronimo 2.1.4 (Jetty 6 and Tomcat 6), Glassfish 2.1 & v3, Apache Tomcat 4.1.39, 5.5.27 & 6.0.18 and Jetty 5.1.15 & 6.1.18 (with JMX enabled). Beside these, it should work on any Servlet Container running on at least Java 1.5.

check_jmx4perl is part of a larger distribution, jmx4perl. In addition to this Nagios plugin, jmx4perl contains tools for exploring and examing the available JMX MBeans on the JEE-Server so that it is easy to discover the MBeans and attributes worth monitoring.

A Mule agent for deploying on the Mule ESB Server is available, too.

You can find Jmx4Perl at CPAN.