Java Reference
In-Depth Information
to a value different than the value in the String monitor. You should eventually
see the following notification type appear in the agent output:
jmx.monitor.string.differs
Play around with the different attributes of the String monitor before moving on
the next section, which discusses the
GaugeMonitor
MBean.
12.2.3
Testing the Gauge monitor
The
GaugeMonitor
MBean operates over the
Gauge
attribute of the
ObservableOb-
ject
MBean. Table 12.7 lists the attributes of the
GaugeMonitor
MBean that you
need to set, along with appropriate values.
Table 12.7 The attributes you need to configure in the
GaugeMonitor
MBean in order to monitor
the
Gauge
attribute of the
ObservableObject
MBean.
Monitor attribute
Value
Description
Tells the MBean to send a notification if
the observed attribute reaches or
exceeds the high threshold
NotifyHigh
true
Tells the MBean to send a notification if
the observed attribute reaches or
moves below the low threshold
NotifyLow
true
Name of the observed attribute from
the subject MBean
ObservedAttribute Gauge
Object name of the subject MBean that
will be monitored by this Gauge monitor
ObservedObject
JMXBookAgent:name=subject
High threshold value
HighThreshold
4.1
Low threshold value
LowThreshold
2.1
You will test this monitor just like the previous MBean. Select the
GaugeMonitor
in the
HTML
adapter and set the attributes as described in table 12.7, and then
invoke the
start()
method by clicking the Start button. Now go back to the
ObservableObject
and set the
Gauge
attribute to a value above the high threshold
of the Gauge monitor. You should see the following appear in the agent output:
jmx.monitor.gauge.high
Once again, go back to the
ObservableObject
MBean and change the
Gauge
attribute to a value below the low threshold value of the
GaugeMonitor
MBean.
The agent will receive the following notification type:
jmx.monitor.gauge.low