...
1. BankMBean:
public boolean getAvailability(); |
2. Bank:
public boolean getAvailability() { return transaction.getAvailability(); } |
3. Modify the monitor-configuration.xml:
a. Define the monitor-semantics:
<availability-configuration-group name="Availability" unit="working"> <description ID="Availability">Bank open/closed for clients</description> <data-collection > <polled-by-monitor period="1" unit="MINUTE"/> </data-collection> <thresholds green-to-yellow="256" yellow-to-red="1024" red-to-yellow="1024" yellow-to-green="256"/> </availability-configuration-group> |
b. Define the monitor-tree:
<availability-monitor name="Open for clients" configuration-group="Availability"> <monitored-resource name="BankMBean" type="APPLICATION"/> <availability-attribute-mapping> <availability-attribute> <observed-resource-attribute name="Availability"/> </availability-attribute> </availability-attribute-mapping> </availability-monitor> |
The monitoring framework expects a Boolean value for availability monitors, that is why the return value of the getAvailability() method is Boolean. This method is declared in the BankMBean interface and is implemented in the class Bank. In the monitor-semantics part of the monitor-configuration.xml, an availability-configuration-group is declared with the name Availability, which is used for creating the node in the monitor tree (the monitor-tree part in the XML).
The Open for Clients monitor appears in the monitoring tree under Applications → Bank Information →General Information.