
Recall the monitor-configuration excerpt from the Installing the Template section, where there were two template-installable monitors described:
public int getExceededClientsMoney(String clientName);
public int getExceededClientsMoney(String clientName) {
return transaction.getExceededClientsMoney(clientName);
}Given a client name, this method returns the exact amount of money for his/her transaction.
<integer-configuration-group name="ExceededClientsMoney" unit="EUR"> <description ID="Exceeded clients money">Money ammount for the exceeded clients.</description> <data-collection> <polled-by-monitor period="1" unit="MINUTE"/> </data-collection> <thresholds green-to-yellow="9999" yellow-to-red="1" red-to-yellow="1" yellow-to-green="9999"/> </integer-configuration-group>
<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>
As you can see, for the information that cannot be supplied statically, the placeholder sign "%" is used.
Result
The Amount monitor appears in the monitoring tree under Applications → Bank Information → List of txs over 10,000 EUR → Transaction No:<xx>.
public long getTransactionDuration(String clientName);
public long getTransactionDuration(String clientName) {
return transaction.getTransactionDuration(clientName);
}Given a client name, this method returns the duration of his/her transaction.
<long-configuration-group name="tsDuration" unit="ms"> <description ID="Transaction duration">Duration of the transaction of this client.</description> <data-collection> <polled-by-monitor period="1" unit="MINUTE"/> </data-collection> <thresholds green-to-yellow="10000" yellow-to-red="14000" red-to-yellow="14000" yellow-to-green="10000"/> </long-configuration-group>
<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>
Again, the placeholder sign "%" is used to denote the dynamically supplied data.
Result
The Transaction duration monitor appears in the monitoring tree under Applications → Bank Information → List of txs over 10,000 EUR → Transaction No:<xx>.