Java Reference
In-Depth Information
Spend some time working with the Gauge monitor so you fully understand its
derived gauge value; you can see that value in the monitor's MBean View. Then
move on to the following section, which discusses the Counter monitor.
12.2.4
Testing the Counter monitor
The CounterMonitor MBean operates over the Counter attribute of the Observ-
ableObject MBean. Table 12.8 lists the attributes of the CounterMonitor MBean
that you need to set, along with appropriate values.
Table 12.8 The attributes you need to configure in the CounterMonitor MBean in order to moni-
tor the Counter attribute of the ObservableObject MBean.
Monitor attribute
Value
Description
Notify
true
Tells the MBean to send a notification if
the observed attribute reaches or exceeds
the threshold
ObservedAttribute Counter
Name of the observed attribute from the
subject MBean
ObservedObject
JMXBookAgent:name=subject Object name of the subject MBean that
will be monitored by this Gauge monitor
Threshold
3
Threshold value
Offset
3
Value of the offset that will be added to
the threshold each time the observed
attribute reaches or exceeds the threshold
DifferenceMode
False
Tells the monitor not to compute the
derived gauge as simply the value of the
observed attribute
Select the subject MBean again and set its Counter attribute to 4 (a value above
the threshold of the CounterMonitor MBean). You should see the following notifi-
cation type in the agent output:
jmx.monitor.counter.threshold
After receiving this notification, go back and look at the MBean View of the Counter-
Monitor MBean and notice that the threshold is now 6 . The monitor has incre-
mented the threshold with the offset value. Every time the observed attribute
reaches or exceeds the threshold, the monitor increases the threshold with the offset.
With that last test, we have completed our coverage of the JMX monitoring
services. Because the monitoring services are considered a mandatory part of
Search WWH ::




Custom Search