Installing the Template
Procedure
- BankMBean:
public String[] getExceededClientsNames();
- Bank:
public String[] getExceededClientsNames() { return transaction.getExceededClientsNames(); }
This method provides the names of all clients that have exceeded 10,000 EUR.
This is the dynamically supplied information that enables the template to install new monitors of a certain type on the fly. All dynamically installed monitors are grouped under a summary named List of txs over 10,000 EUR.
- Modify the monitor-configuration.xml:
- Define the monitor-semantics:
- Define the monitor-tree:
<summary name="List of txs over 10,000 EUR" configuration-group="ExceededClientsNames"> <object name="%0" configuration-group="Exceeded"> <template-info template-name="ExceededClients"> <polled-by-template period="1" unit="MINUTE"> <generating-resource name="BankMBean" type="APPLICATION"/> <template-attribute-mapping> <observed-resource-attribute name="ExceededClientsNames"/> </template-attribute-mapping> </polled-by-template> </template-info> <integer-monitor name="Amount" configuration-group="ExceededClientsMoney"> <monitored-resource name="BankMBean" type="APPLICATION"/> <integer-attribute-mapping> <integer-attribute> <invoked-resource-method name="getExceededClientsMoney"> <parameter position="0" type="String" value="%0"/> </invoked-resource-method> </integer-attribute> </integer-attribute-mapping> </integer-monitor> <long-monitor name="Transaction duration" configuration-group="tsDuration"> <monitored-resource name="BankMBean" type="APPLICATION"/> <long-attribute-mapping> <long-attribute> <invoked-resource-method name="getTransactionDuration"> <parameter position="0" type="String" value="%0"/> </invoked-resource-method> </long-attribute> </long-attribute-mapping> </long-monitor> </object>
The element that installs the template is <template-info> . In the case of this example, this element specifies that on each new entry in the dynamically supplied data, the monitoring framework must install a new subtree of monitors which, as a root, has an object with the name of the respective client, and configuration group Exceeded.
Result
The List of txs over 10,000 EUR monitor appears in the monitoring tree under Applications → Bank Information.