Show TOC Start of Content Area

This graphic is explained in the accompanying text Using Template Monitors  Locate the document in its SAP Library structure

In this example, the resource provider can use the following template in the monitor-configuration.xml:

<summary name="VIP Clients" configuration-group="BankVIPClientsList">

    <object name="%0" configuration-group="BankVIPClient">

 

     <template-info template-name="BankVIPClientTemplate">

       <polled-by-template period="5" unit="MINUTE">

          <generating-resource name="BankResourceMBean" type="APPLICATION"/>

          <template-attribute-mapping>

             <invoked-resource-method name="listVIPClientIDs"/>

          </template-attribute-mapping> 

       </polled-by-template>

    </template-info>

 

 

     <text-monitor name="Client's Name" configuration-group="BankClientName">

        <monitored-resource name="BankResourceMBean" type="APPLICATION"/>

        <text-attribute-mapping>

           <text-attribute>

             <invoked-resource-method name="getClientName">

                <parameter position="0" type="int" value="%0"/>

             </invoked-resource-method>

           </text-attribute>

        </text-attribute-mapping>

     </text-monitor>

 

     <configuration-monitor name="Client's Address" configuration-group="BankClientAdress">

        <monitored-resource name="BankResourceMBean" type="APPLICATION"/>

        <configuration-attribute-mapping>

           <configuration-attribute>

             <invoked-resource-method name="getClientAddress">

                <parameter position="0" type="int" value="%0"/>

             </invoked-resource-method>

           </configuration-attribute>

        </configuration-attribute-mapping>

     </configuration-monitor>

 

     <long-monitor name="Client's Phone Number" configuration-group="BankClientPhone">

        <monitored-resource name="BankResourceMBean" type="APPLICATION"/>

        <long-attribute-mapping>

           <long-attribute>

             <invoked-resource-method name="getClientPhone">

                <parameter position="0" type="int" value="%0"/>

             </invoked-resource-method>

           </long-attribute>

        </long-attribute-mapping>

     </long-monitor>

 

 

    </object>

</summary>

 

In the example above, pay attention to the <template-info> element and the “%0” sign used in the description of the monitoring tree nodes. The node under which the <template-info> element is situated is the root of a template installable part of the monitoring tree. In the example, the root is the object with configuration group BankVIPClient. All the nodes that are described below this root are not installed directly and instead become part of the template (the whole <object> element together with all the elements below it form the template) and are installed together as a sub-tree when dynamic data is provided or retrieved from the monitored resource. For example, if the monitored resource returns the array {0, 1}, two objects with names “0” and “1” will be installed and below each of them there will be three monitors for each of the client’s attributes mentioned before.

Apart from denoting the root of a template, the <template-info> element is used for specifying how dynamic data is provided by the resource MBean to the monitoring framework. In the example, the monitoring framework checks every five minutes for new entities.

The dynamic data listing all the entities (mapping to sub-trees in the monitoring tree) is sent as a one- or two-dimensional array. In the more general case of two-dimensional arrays, each row in the array represents a single entity and is used for the installation of one sub-tree. To instruct the template how the data supplied has to be used when installing the sub-tree, the sign “%” is used, followed by a number. The number (starting from 0) is the consecutive number of the value in the entity’s row. In the more simple case with one-dimensional array, only “%0” can be used as there is only one value for each entity.

To get an impression when a two-dimensional array is used, magine that the resource developer has not definedclientIDs as names of the objects in the monitoring tree, but has specified instead a name that provides more information. In this case, a two-dimensional array is returned in the listVIPClientIDs method where the first value in the row is the clientID and the second value is a descriptive name for this ID. Therefore, in the template, instead of using “%0” as a name, you can use “%1” (while “%0” will still be used as a parameter in the invoked methods in the monitors described below). That is, in the case of a two-dimensional array you keep the same source as in the example above, but you only change the <object> element, which will turn to:

<object name="%1" configuration-group="BankVIPClient">

 

As a result, the objects is shown with more descriptive names.

Note

One restriction that exists when working with templates is that overlapping templates is not allowed, that is, it is not possible to have a template inside another template.

 

 

End of Content Area