Increasing the alert severity
The final task that you want the policy to perform is to increase the severity of the alert.
About this task
For example, if the department that it affects has a mission critical function in the business. For the purposes of this tutorial, the departments in the business whose function is mission critical are the data center and transaction processing units.
To perform
this task, the policy must iterate through each of the Department data items
that are retrieved in the previous step. For each Department,
it must test the value of the Name field against
the names of the two departments in the business that have mission
critical functions. If the Department name is that
of one of the two departments, the policy must increase the severity
of the alert to Critical.
Count = Length(MyDepts);
While (Count > 0) {
Index = Count - 1;
MyDept = MyDepts[Index];
If (MyDept.Name == "Data Center" || MyDept.Name == "Transaction Processing") {
@Severity = 5;
}
Count = Count - 1;
}Here, you use a While loop to iterate
through the elements in the MyDepts array. MyDepts is
the array of Department data items that were returned
previously in the policy by a call the GetByLinks.
Before
the While loop begins, you set the value of the Count variable
to the number of elements in the MyDepts array. Each
time the loop runs, it tests the value of Count.
If Count is greater than zero, the statements inside
the loop are executed. If Count is less than or equal
to zero, the statements are not executed. Because Count is
decremented by one each time the loop is performed, the While loop
runs once for each data item in MyDepts.
A
variable named Index is used to refer the current
element in the array. The value of Index is the value
of Count minus one, as Netcool®/Impact arrays
are zero-based structures whose first element is counted as zero instead
of one.
Inside the loop, the policy uses an If statement
to test the name of the current Department in the
array against the name of the two mission-critical business departments.
If the name of the current Department matches the
mission-critical departments, the policy sets the value of the Severity field
in the alert to 5, which signifies a critical severity.