Chapter 9. The Monitoring Services

In Chapter 8, we looked at the JMX notification model and how to write and use notification broadcasters and listeners. In this chapter, we will look at a few off-the-shelf implementations of notification broadcasters provided by JMX, called the monitoring services, or monitors. A monitor observes the attribute value of an MBean, called the observed object, at specific intervals, called the granularity period. From this observation, the monitor calculates a value called the derived gauge, which is either the value of the attribute or the difference between the values of the attribute at the two most recent observations (for numerical attributes only, of course). When the derived gauge satisfies a certain condition—which varies depending on the type of monitor in use—a notification of a type that is specific to that monitor is sent to all registered notification listeners. The monitoring service can also send error notifications if a problem occurs.

The JMX specification’s monitoring services provide three types of monitors:

Counter monitors

Observe a continually increasing, nonnegative integer MBean attribute (of type byte, short, int, long, or the corresponding JDK wrapper class) and send a notification when the derived gauge exceeds a certain value, known as the threshold

Gauge monitors

Observe an arbitrarily changing numeric value (of type int, long, float, double, or the corresponding JDK wrapper type) and send a notification when the derived ...

Get Java Management Extensions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.