JMX Plugins for version 62 or older

JMX Plugins for Version 62 or older

The JMX plugin is an AppFirst Java application that connects to a JMX remote port, access any available MBean and places the result in the AppFirst data stream. These results are then available for access by the AppFirst APIs and are visible in the web application. Moreover, the JMX data can be used to generate alerts. In general, the AppFirst JMX application will be executed on the same host that your Java application is hosted.

In order to access your MBean statistics values through JMX you need to do two things, at a high level:

  1. Enable the use of JMX when you start your Java application
  2. Start the AppFirst JMX plugin with appropriate command line options to connect to JMX remote and specify a specific MBean

Enable JMX

When starting your Java application you need to specify one or more JMX Management and Monitoring Properties. At a minimum you need to specify com.sun.management.jmxremote.port=. Specify a port number that is not currently in use. Unless you have an environment already configured to support remote authentication, with a Java password file and SSL certificates, it is generally useful to enable the following properties: com.sun.management.jmxremote.authenticate=false and com.sun.management.jmxremote.ssl=false.

Given that example, a java command line to start the examples with solr would look like this:

% java -Dcom.sun.management.jmxremote.port=1616  -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar start.jar

Start AppFirst JMX Plugin

The AppFirst JMX is executed by the AppFirst collector at a specified interval. You manage configuration of the specific plugins to be executed and their command line options from the management web application (see above for details) using the collector polled data configuration.

The recommended procedure is to test the specific command line on the local server before modifying the collector polled data configuration. Once you have a command line that works, add it to the collector polled data configuration using the management web application.

A sample command line to extract non-heap memory usage, just a very simple example, looks like this:

	% java -jar appfirst_jmxquery.jar -U service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi -O java.lang:type=Memory -A NonHeapMemoryUsage -K used

The command line options are defined as:
Usage:

check_jmx -help | -U url query_object; [query_object;]

and

query_object = -O object_name -A attribute [-K compound_key] [-I attribute_info] [-J attribute_info_key] [-w warn_limit] [-c crit_limit]

where options are:

-help
Prints this page

-U
JMX URL, for example: “service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi”

-O
Object name to be checked, for example, “java.lang:type=Memory”

-A
Attribute of the object to be checked, for example, “NonHeapMemoryUsage”

-K
Attribute key for -A attribute compound data, for example, “used” (optional)

-I
Attribute of the object containing information for text output (optional)

-J
Attribute key for -I attribute compound data, for example, “used” (optional)

-w
warning integer value

-c
critical integer value

-T
type, whether the value is a cumulative value. 0 is non-cumulative, 1 is cumulative.

Note that if warning level > critical, system checks object attribute value to be LESS THAN OR EQUAL warning, critical
If warning level < critical, system checks object attribute value to be MORE THAN OR EQUAL warning, critical

Source code for the is available at https://github.com/appfirst/appfirst_jmxcheck.