...
1. BankMBean:
public Serializable[][] getDesks(); |
2. Bank:
public Serializable[][] getDesks() { return BankProperties.getDesks(); } |
3. Modify the monitor-configuration.xml:
a. Define the monitor-semantics:
<table-configuration-group name="CounterDesks"> <description ID="Counter desks">Name of the cashier, number of the desk, floor</description> <data-collection> <polled-by-monitor period="1" unit="MINUTE"/> </data-collection> <columns> <column>Name</column> <column>Desk number</column> <column>Floor</column> </columns> </table-configuration-group> |
b. Define the monitor-tree:
<table-monitor name="Counter desks" filename="Bank.CounterDesks" configuration-group="CounterDesks"> <monitored-resource name="BankMBean" type="APPLICATION"/> <table-attribute-mapping> <table-entries-attribute> <observed-resource-attribute name="Desks"/> </table-entries-attribute> </table-attribute-mapping> </table-monitor> |
The monitoring framework expects a Serializable[][] value for the table monitors, that is why the return value of the getDesks() method is Serializable[][]. This method is declared in the BankMBean interface and it is implemented in the class Bank. In the monitor-semantics part of the monitor-configuration.xml a table-configuration-group is declared with name CounterDesks, which is used for creating the node in the monitor tree (the monitor-tree part in the XML). The ID in the Counter desks description is the name of the monitor shown in the tree. The table has 3 columns: Name, Desk number, and Floor, declared in monitor-semantics under the <columns> tag.
The Counter Desks monitor appears in the monitoring tree under Applications → Bank Information → General Information.