Assigning temporary elements in rules files
You can create a temporary element in a rules file by assigning it to an expression.
For example:
$tempelement = "message"
An
element, $tempelement
, is created and assigned the string
value message
.
If you refer to an element that has
not been initialized in this way, the element is set to the null string (""
).
The
following example creates the element $b
and sets it to setnow
:
$b="setnow"
The
following example then sets the element $a
to setnow
:
$a=$b
In
the following example, temporary elements are used to extract information
from a Summary
element, which has the string value: The
Port is down on Port 1 Board 2
.
$temp1 = extract ($Summary, "Port ([0-9]+)")
$temp2 = extract ($Summary, "Board ([0-9]+)")
@AlertKey = $temp1 + "." + $temp2
The extract
function
is used to assign values to temporary elements temp1
and temp2
.
Then these elements are concatenated (using the +
concatenate
operator ) with a .
separating them, and assigned to the
AlertKey field. After these statements are run, the AlertKey field has the
value 1.2
.