When writing a HierarchyFile, consider the degree to which the current environment is expected to change. When expecting minimal change, use the <group> XML tag to explicitly name elements from incoming alarms.
Assume that the network has only one host. This single group handles assigning host names to incoming alarms.
group description="Hosts" class="Hosts"> <group description="hostname" class="hostname" <filter> <field name="hostname" value="BSCMserver"/> </filter> </group> </group>
If you expect that the element structure will grow or change, or the exact nature of incoming alarms from a management system is unknown, use the <generator> tag.
The following example creates an element container (parent element) for each host name. The Hosts group contains a single <generator> statement which creates new elements when an incoming alarm has a new value for the field. Each new element name will contain the field value.
<group description="Hosts" class="Hosts"> <generator field="hostname" class="hostname"/> </group>
The above example avoids having to constantly update the HierarchyFile with specific hostnames. The generator dynamically creates a hostname element whenever it detects a new host and automatically adds it to the hierarchy, as well as automatically assign incoming alarms to the new element.
Alternatively, use the class_from_field attribute in place of the class attribute to name the element’s class using field values.
<generator> statements can create more complicated structures, either by nesting or in combination with the other tags such as <groups> and <filters>.