Java Reference
In-Depth Information
ServerDelegate MBean, you should see the ObservableObject MBean (the sub-
ject MBean) and the three monitor MBeans. If you do not see all the MBeans in
the Agent View, refresh the page after a few moments.
To test the monitors, you need to set a few attributes for each one so it can
observe your subject MBean. The following sections explain what you need to do.
12.2.2
Testing the String monitor
The StringMonitor MBean operates over the String attribute of the Observable-
Object MBean. Table 12.6 lists the attributes of the StringMonitor MBean that
you need to set, along with the appropriate values.
Table 12.6 The attributes you need to configure in the StringMonitor MBean in order to monitor
the String attribute of the ObservableObject MBean.
Monitor attribute
Value
Description
NotifyDiffer
true
Tells the MBean to send notifications
when the observed attribute differs from
the monitor's value
NotifyMatch
true
Tells the MBean to send notifications
when the observed attribute differs from
the monitor's value
ObservedAttribute String
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 String monitor
StringToCompare
Abc
The value the monitor will compare to
the observed attribute (you can pick any
value)
Select the StringMonitor in the HTML adapter and set the attributes as described in
table 12.6 (don't forget to click the Apply button). After all the values are set, click
the Start button to invoke the start() method. To receive notifications from the
String monitor, set the String attribute of your subject MBean to match the value
set in the String monitor. You should see the following appear in the agent output:
jmx.monitor.string.matches
If you again return to the StringMonitor MBean View, you can see that the String
monitor's derived gauge is equal to the value set in the subject MBean's String
attribute. Now go back and change the String parameter of the subject MBean
Search WWH ::




Custom Search