![]() |
![]() |
[ Bottom of Page | Previous Page | Next Page | Contents | Index ]
When the event under analysis matches the conditions in the initial event filter of a rule, the rule is triggered and the rule engine runs the actions of the rule. A rule can contain one or more actions, each separated by a comma. A rule action contains one or more predicate calls. The following example shows the structure of a very simple rule action.

The types of actions are shown in the following list, and described in Action types.
An action should be given a meaningful name, so it can be easily identified when tracing rules. Action names must also be unique within each rule. If you don't provide a name for an action, the rule compiler assigns its own names, such as action_1, action_2, and so forth.
The rule engine runs actions in sequential order as defined by their position in the rule, unless a predicate is called that changes the flow of control, such as the commit_action predicate. There is no guarantee of execution order of predicate calls within an action. (Actually, predicate execution order within an action conforms to Prolog logic execution rules.) If you do not know Prolog logic execution rules and want predicates to run in a certain order, place them in separate actions within a rule and order the actions accordingly.
There are three types of rule actions, described as follows:
The following example shows the usage of different action types:
If this action would have been written as a redo_action instead of a regular action, it would only run upon a redo request. By specifying the event linking to occur in a regular action, the action will run regardless of the order of arrival of events. For additional information about redo requests, see redo_analysis.
rule: link_oserv_to_host: (
description: 'Link the universal_oserv to universal_host
if they are related',
event: _event of_class 'universal_oserv'
where [probe_arg: _probe_arg,
severity: equals 'WARNING'],
reception_action: 'oserv_script': (
exec_program(_event,
'oserv_beep.sh','%s',[_probe_arg],
'YES')
),
action: 'link_host': (
first_instance(
event: _host_ev of_class 'universal_host'
where [severity: within ['CRITICAL','FATAL'],
probe_arg: equals _probe_arg,
status: outside ['CLOSED']
]),
set_event_status(_event,'ACK'),
link_effect_to_cause(_event, _host_ev)
)
).
Directives can be included in rules. Directives specified within rule sets or rules are defined with the directive: keyword syntax. If you specify more than one directive in a directive clause, separate the directives with commas; for example, directive: fire_on_non_leaf, profile. The directives are described as follows:
The following example shows a use of the directive. This particular example causes the rule to evaluate all events because it specifies the base event class EVENT in its event filter. All other classes inherit from the base event class.
rule: test_rls: (
directive: fire_on_non_leaf,
event: _evt of_class within [ 'EVENT' ]
where [ ],
reception_action: action0:
(
drop_received_event
)
).
[ Top of Page | Previous Page | Next Page | Contents | Index ]