How to create a test tag in a hierarchy file that filters on sub string

  • 7006570
  • 04-Aug-2010
  • 11-Jul-2012

Environment

Business Service Manager 4.5
Business Service Manager 4.6
Business Service Manager 4.7

Situation

You want to filter out alarms based on a sub string match of a particular alarm field
The filter tag does not support sub string matches and contains will not work.

Resolution

Use a test tag that executes a formula script fragment to check to alarm field.

Filter example:
<filter>
  <test type="script" expr="if(alarm.hrln4.charAt(2) == 'F') { false } else { true};" />
</filter>

In the example above, the script tests the third character of an alarm field. If the field value is 'F', then the filter does not pass, any other value returns true.

Example hierarchy:
 <generator field="class" class_from_field="class" hold="yes" affected="yes">
        <generator field="ems" class_from_field="class" hold="yes" affected="yes">
            <generator field="hrln3" class_from_field="hrlt3" affected="yes">
                <filter>
                  <test type="script" expr="if(alarm.hrln4.charAt(2) == 'F') { false } else { true};" />
                </filter>
                <generator field="hrln4" class_from_field="hrlt4" affected="yes">
                    <generator field="hrln5" class_from_field="hrlt5" affected="yes" />
                </generator>
            </generator>
        </generator>
    </generator>

If the filter returns true, then the generators on field hrln4 and hrln5 will not be processed.