IBM Tivoli Software IBM Tivoli Software

[ Bottom of Page | Previous Page | Next Page | Contents | Index ]


Alphabetic listing of rule language predicates

The following section lists the rule language predicates in alphabetical order.

add_to_repeat_count

Adds a number to the repeat_count attribute for an event.

Synopsis

add_to_repeat_count(_event, number)

Description

This predicate is typically used to keep a count of duplicate events that are received. As they are received the repeat_count attribute of the original event is updated with this predicate and the duplicate event is dropped.

Arguments

_event
The event whose repeat_count attribute is incremented.
number
The number added to the current repeat_count attribute value.

Examples

The following example shows how events for printer problems are managed:

  1. An event cache query is run searching for the first duplicate event that matches the class of the event under analysis and not closed. The time window for the search is 10 minutes.
  2. If a duplicate event is found in the cache, the cached event's repeat_count attribute is incremented by 1, the newly received event is dropped, and rule evaluation continues with the next rule set.

    If a duplicate is not found, the newly received event is processed as usual and added to the event cache.

rule: printer_problem:(
  event: _event of_class 
                within ['Printer_Paper_Out',
                        'Printer_Toner_Low',
                        'Printer_Offline',
                        'Printer_Output_Full',
                        'Printer_Paper_Jam',
                        'Printer_Door_Open'],
  reception_action:
    (
    first_duplicate( _event,
            event: _printer_ev
                where [
                    status: outside ['CLOSED']
                    ],
            _event - 600 - 600
            ),
    commit_rule,
    add_to_repeat_count(_printer_ev, 1),
    drop_received_event
    )
  ).

See Also

first_duplicate

all_clear_targets

Returns all events in the cache that the specified clearing event clears.

Synopsis

all_clear_targets(_clear_event, _target_event)

--OR--

all_clear_targets(_clear_event, _target_event, time_before, time_after)

Description

This predicate is used to search the event cache for all of the events that _clear_event clears. Each found event is returned in _target_event.

If the time_before and time_after arguments are not specified, the event cache search time window takes the default value of 2 years (1 year before and 1 year after). You should limit a time window to the smallest reasonable window whenever possible for better performance.

Arguments

_clear_event
A pointer to the clearing event.
_target_event
A pointer to each event found in the cache that _clear_event clears. Must be free.
time_after
The number of seconds after _clear_event has been received. This argument is used to limit the event cache search to a time window.
time_before
The number of seconds before _clear_event has been received. This argument is used to limit the event cache search to a time window.

Examples

The following example searches the event cache for all events that are cleared by the event under analysis. As each event is found, it is closed. This rule triggers on the base event, so every incoming leaf event is tested.

rule: 'clear_target_events':(

  event: _clr_ev of_class 'EVENT',

  action: 'search_for_target':(
    all_clear_targets(__clr_ev, _tgt, 3600, 0),
    set_event_status(_tgt, 'CLOSED')
  )
).

See Also

any_clear_target, create_clearing_event , create_event_sequence

all_duplicates

Succeeds once for each duplicate event that satisfies the specified additional attribute and time window conditions.

Synopsis

all_duplicates(_event, event: _duplicate where attribute_conditions)

--OR--

all_duplicates (_event, event: _duplicate where attribute_conditions, _referenceEvent -time_before -time_after)

Description

The rule engine does not explicitly provide a loop structure. However, the all_duplicates predicate returns multiple solutions one at a time. When the rule engine runs the all_duplicates predicate, it analyzes all solutions individually and runs the remaining sequence of predicates in the action for each solution.

No class specification is required, since duplicate events are the same class as the event under analysis. For additional information about duplicate events, see What is a duplicate event?.

Arguments

_event
A pointer to the event currently under analysis.
_referenceEvent
A pointer to the reference event for the time window, typically the event under analysis.
event:_duplicate where attribute_conditions
Specifies an event filter for querying the event cache. _duplicate is instantiated with a pointer to each duplicate event found. See Event filters for additional information.
-time_after
The number of seconds after the reference event.
-time_before
The number of seconds before the reference event.

Examples

The following example shows a rule that:

  1. Queries the event cache for duplicates of the OV_NODE_DOWN class that are not closed and within a 600 second time window of the event under analysis.
  2. When duplicate events are found, their severity is assigned the same severity as the event under analysis.
rule: dup_nfs_not_resp:(

  event: _event of_class 'OV_NODE_DOWN'
    where [severity: _severity],

  action: dup_event_severity:(
    all_duplicates(_event, event: _dup_OV_ev
                   where [status: outside ['CLOSED'] ],
                   _event -300 -300
                  ),

    set_event_severity(_dup_OV_ev, _severity)
  )
).

See Also

first_duplicate

all_instances

Succeeds once for each event that satisfies the specified class, attribute, and time window conditions.

Synopsis

all_instances(_event, event: _eventInstance of_class class where attribute_conditions)

--OR--

all_instances(_event, event: _eventInstance of_class class where attribute_conditions, _referenceEvent -time_before -time_after)

Description

The rule engine does not explicitly provide a loop structure. However, the all_instances predicate returns multiple solutions one at a time. When the rule engine runs the all_instances predicate, it analyzes all solutions individually and runs the remaining sequence of predicates in the action for each solution.

Arguments

_event
A pointer to the event currently under analysis.
_referenceEvent
A pointer to the reference event for the time window, typically the event under analysis.
event: _eventInstance of_class class where attribute_conditions
Specifies an event filter for querying the event cache. _eventInstance is instantiated with a pointer to each event instance found. See Event filters for additional information.
-time_after
The number of seconds after the reference event.
-time_before
The number of seconds before the reference event.

Examples

The following example action closes all NFS_SERVER_NOT_RESPONDING events whose server attribute has a value of Pascal:

action: (
  all_instances(_event, event:_nfs_ev of_class
                'NFS_SERVER_NOT_RESPONDING'
    where [server: equals 'Pascal' ]),
  set_event_status (nfs_ev, 'CLOSED')
)

See Also

first_instance

any_clear_target

Returns the most recent event in the cache that the specified clearing event clears.

Synopsis

any_clear_target(_clear_event, _target_event)

--OR--

any_clear_target(_clear_event, _target_event, time_before, time_after)

Description

This predicate is used to search the event cache for the first event that _clear_event clears. The found event is returned in _target_event.

If the time_before and time_after arguments are not specified, the event cache search time window defaults to two years (one year before and one year after). For performance reasons, you should limit a time window to the smallest reasonable window whenever possible.

Arguments

_clear_event
A pointer to the clearing event.
_target_event
A pointer to the first event found in the cache that _clear_event clears. Must be free.
time_after
The number of seconds after _clear_event has been received. This argument is used to limit the event cache search to a time window.
time_before
The number of seconds before _clear_event has been received. This argument is used to limit the event cache search to a time window.

Examples

The following example searches the event cache for the first event found that is cleared by the event under analysis. If an event is found, it is closed.

rule: 'clear_target_event':(

  event: _clr_ev of_class 'EVENT',

  action: 'search_for_target':(
    any_clear_target(_clr_ev, _tgt, 3600, 0),
    set_event_status(_tgt, 'CLOSED')
  )
).

See Also

all_clear_targets, create_clearing_event , create_event_sequence

any_clearing_event

Returns the first event in the cache that clears the reference event.

Synopsis

any_clearing_event(_event, _clear_event)

--OR--

any_clearing_event(_event, _clear_event, time_before, time_after)

Description

This predicate is used to search the event cache for the first clearing event that can be found for _event.

If the time_before and time_after arguments are not specified, the event cache search time window defaults to 2 years (1 year before and 1 year after). You should limit a time window to the smallest reasonable window whenever possible for better performance.

Arguments

_clear_event
A pointer to the first clearing event found for _event. Must be free.
_event
A pointer to the event whose clearing event is being searched for.
time_after
The number of seconds after _event has been received. This argument is used to limit the event cache search to a time window.
time_before
The number of seconds before _event has been received. This argument is used to limit the event cache search to a time window.

Examples

The following example searches the event cache for the first event found that clears the event under analysis. If a clearing event is found, the event under analysis is closed and processing is finished. This rule triggers on the base event, so every incoming leaf event is tested.

rule: 'check_for_clear':(

  event: _ev of_class 'EVENT',

  action: 'search_for_clear':(
    any_clearing_event(_ev, _clr, 3600, 0),
    set_event_status(_ev, 'CLOSED'),
    commit_set
  )
).

See Also

create_clearing_event , create_event_sequence

attr_condition

Defines absolute attribute conditions for a single event in an event sequence.

Synopsis

attr_condition([classes], [attribute_conditions])

Description

This predicate is used to define attribute conditions for some of the problem events in an event sequence. It must be called from the event_details argument of the create_event_sequence predicate. (The attribute_conditions argument of the create_event_sequence predicate defines attribute conditions for all events in an event sequence.)

Attribute conditions for clearing events are defined with the clears predicate.

Arguments

classes
The names of one or more event classes for which the attribute conditions apply, in list format. For example, ['upsOnBattery','lowBattery','upsDischarged'].
attribute_conditions
The list of conditions for attributes that must be met by the subset of event classes in the event sequence defined with the classes argument. Only absolute conditions apply. An absolute condition is similar to an attribute condition in an event filter. For example, [severity,equals,'HARMLESS']. To specify multiple attribute conditions, use a nested list; for example, [[severity,equals,'HARMLESS'],[hostname,equals,orange]].

See the attribute_conditions argument description for the create_event_criteria for additional details about specifying attribute conditions for this argument, as the syntax is the same.

Examples

The following example shows the event sequence for events sent from two monitoring sources: American Power Conversion (APC) uninterruptible power supply and IBM Tivoli Distributed Monitoring. APC events use the hostname attribute to identify affected components. Tivoli Distributed Monitoring uses the probe_arg attribute of the universal_host event to identify affected components.

The attr_condition predicate defines the attribute conditions that must be met by the universal_host event to be eligible for correlation (in this case the severity attribute must equal a value of FATAL).

The attr_exception predicate shows how to do the attribute mapping so the events in the sequence from the two different sources can be correlated.

create_event_sequence(
  ['upsOnBattery',
   'lowBattery',
   'upsDischarged',
   'universal_host'],

  ['hostname', ['status','outside',['CLOSED']]
  [
   clears('powerRestored',[ ], ['upsOnBattery'],[ ]),
   clears('returnFromLowBattery',[ ], ['lowBattery'],[ ]),
   clears('dischargeCleared',[ ],['upsDischarged'],[ ]),
   clears('universal_host', 
          [ ['severity', equals,'HARMLESS'] ]
          ['universal_host'], 
          [ ]),
   attr_condition('universal_host',
                  ['severity',equals,'FATAL']),
   attr_exception('hostname','universal_host',
                  'probe_arg')
  ]
),

See Also

attr_exception , create_clearing_event , create_event_sequence

attr_exception

Defines an attribute that must match a different attribute in other events in an event sequence.

Synopsis

attr_exception(attribute, [classes], exception_attribute)

Description

This predicate is used to define attribute conditions for other problem events in an event sequence when the attributes do not match up between the events. It must be called from the event_details argument of the create_event_sequence predicate.

For example, suppose a monitoring system generates its events with the name of affected machines in the hostname attribute. Suppose a different monitoring system assigns the names of affected machines in the probe_arg attribute. In order to correlate these two events based on machine name, you must map the two different attributes to each other using the attr_exception predicate.

Multiple attribute exceptions for an event sequence must be defined with multiple attr_exception predicates.

Arguments

attribute
The attribute to map the exception attribute to. This attribute must be defined in the attribute_conditions argument of the create_event_sequence predicate for the event sequence.
classes
The list of problem event classes for which mapping to attribute is valid.
exception_attribute
The exception attribute to map to attribute.

Examples

The following example shows the event sequence for events sent from two monitoring sources: APC uninterruptible power supply and Tivoli Distributed Monitoring. APC events use the hostname attribute to identify affected components. Tivoli Distributed Monitoring uses the probe_arg attribute of the universal_host event to identify affected components. The attr_exception predicate shows how to do the mapping so events are correlated.

create_event_sequence(['upsOnBattery', 'lowBattery', 
                       'upsDischarged', 'universal_host'],

                       ['hostname', ['status', 'outside',
                                     ['CLOSED']],

                       [attr_exception('hostname', 
                                       'universal_host',
                                       'probe_arg')]
)

See Also

create_event_sequence

attr_sequence

Defines the values of an attribute that change due to an event's position in an event sequence.

Synopsis

attr_sequence(class, attribute=[value_sequence])

Description

This predicate is used for event classes in an event sequence whose names remain the same but use an attribute value to indicate a status change. It must be called from the event_details argument of the create_event_sequence predicate. It defines the sequence of changed values that the attribute can have as it progresses along an event sequence from left to right.

Note:
An event class that adheres to this implementation can only have one attribute sequence defined.

Arguments

attribute
The name of the attribute whose changing value indicates status.
class
The name of the event class containing the attribute.
value_sequence
The values, in event sequence, of the attribute that indicate status. This argument is a list.

Examples

The following example shows an event sequence for Compaq physical drive events. These events are all of the same class (cpqTape3PhDrvStatusChange). The cpqTapePhyDrvCondition attribute value changes to indicate status, with a value of OK signifying a clearing event.

To accommodate this implementation of one event class with a changing attribute value for all of the events in an event sequence, the attribute and sequence of values (in event sequence order from left to right) must be defined with an attr_sequence predicate.

create_event_sequence(
  ['cpqTape3PhyDrvStatusChange'],
  ['hostname', ['status', 'outside', ['CLOSED']]]
  [attr_sequence(
    'cpqTape3PhyDrvStatusChange',
    'cpqTapePhyDrvCondition'=['Degraded', 'Failed'])
  ]
)

See Also

create_event_sequence

bo_add_at_slotval_begin

Adds an element to the beginning of an attribute's list of values.

Synopsis

bo_add_at_slotval_begin(_event, _attribute, _value)

Description

This predicate adds the value _value at the beginning of the list of values for attribute _attribute in event _event. This predicate is applicable only if the data type of _attribute is a list.

Arguments

_attribute
The name of an attribute in _event.
_event
A pointer to the event under analysis.
_value
The value to be added to the list.

Examples

The following example adds a value to the beginning of the acl attribute. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,
         % _class is unified with Su_Success.

  action: (

    % Before the call, the 'acl' attribute contains
    % [admin].

    bo_add_at_slotval_begin(_event, 'acl','user')

    % Now the 'acl' attribute contains [user,admin].
  )
).

See Also

None.

bo_add_at_slotval_end

Adds an element to the end of an attribute's list of values.

Synopsis

bo_add_at_slotval_end(_event, _attribute, _value)

Description

This predicate adds the value _value at the end of the list of values for attribute _attribute in event _event. This predicate is applicable only if the data type of _attribute is a list.

Arguments

_attribute
The name of an attribute in _event.
_event
A pointer to the event under analysis.
_value
The value to be added to the list.

Examples

The following example rule adds a value to the end of the acl attribute. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,
         % _class is unified with Su_Success.

  action: (

    % Before the call, the 'acl' attribute contains
    % [admin].

    bo_add_at_slotval_end(_event, 'acl','senior')

    % Now the 'acl' attribute contains [admin,senior].
  )
).

See Also

None.

bo_get_class_of

Gets the class of an event.

Synopsis

bo_get_class_of(_event, _classname)

Description

This predicate retrieves in _classname the name of the class that _event is an instance of. If _classname is instantiated, the predicate only succeeds when the value corresponds to the class name of the event.

Arguments

_classname
The name of the class of _event.
_event
A pointer to the event under analysis.

Examples

The following example shows how to get the class name of the event under analysis. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,
         % _class is unified with Su_Success.

  action: (
    bo_get_class_of(_event, _classname)
    % _classname is unified with 'Su_Success'.

  )
).

See Also

None.

bo_get_class_slots

Gets attribute information for an event class.

Synopsis

bo_get_class_slots(_classname, _attributes)

Description

This predicate retrieves in _attributes the list of attributes and their definitions for class _classname. The list includes all attributes known to the class; that is, all the attributes defined for the class, as well as any attributes that are inherited from any superclasses.

Arguments

_attributes
A list of the attributes and their definitions that are known to the event class.

For each attribute, the following information is provided:

  1. Name
  2. Complex type
  3. Element type
  4. Setting for parse facet
  5. Setting for dup_detect facet
Each element of the list is in the following format:
slot(attribute_name,complex_type,
element_type,parse_setting,dup_detect_setting,'')
_classname
The name of the event class.

Examples

The following example shows how to get a list containing the attribute definitions for the class of the event under analysis. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,
         % _class is unified with Su_Success.

  action: (
    bo_get_class_slots(_class, _slots)
  )
).

The following list is unified with _attributes for this example. The last piece of information for each attribute is empty and reserved for future IBM use.

[slot(server_handle,SINGLE,INTEGER,NO,NO,''),
slot(date_reception,SINGLE,INT32,NO,NO,''),
slot(event_handle,SINGLE,INTEGER,NO,NO,''),
slot(source,SINGLE,STRING,YES,NO,''),
slot(sub_source,SINGLE,STRING,YES,NO,''),
slot(origin,SINGLE,STRING,YES,NO,''),
slot(sub_origin,SINGLE,STRING,YES,NO,''),
slot(hostname,SINGLE,STRING,YES,NO,''),
slot(fqhostname,SINGLE,STRING,YES,NO,''),
slot(adapter_host,SINGLE,STRING,YES,NO,''),
slot(date,SINGLE,STRING,YES,NO,''),
slot(status,SINGLE,STATUS,YES,NO,''),
slot(administrator,SINGLE,STRING,NO,NO,''),
slot(acl,LIST_OF,STRING,NO,NO,''),
slot(credibility,SINGLE,INTEGER,NO,NO,''),
slot(severity,SINGLE,SEVERITY,YES,NO,''),
slot(msg,SINGLE,STRING,YES,NO,''),
slot(msg_catalog,SINGLE,STRING,YES,NO,''),
slot(msg_index,SINGLE,INTEGER,YES,NO,''),
slot(duration,SINGLE,INTEGER,NO,NO,''),
slot(num_actions,SINGLE,INTEGER,NO,NO,''),
slot(repeat_count,SINGLE,INTEGER,YES,NO,''),
slot(cause_date_reception,SINGLE,INT32,NO,NO,''),
slot(cause_event_handle,SINGLE,INTEGER,NO,NO,''),
slot(pid,SINGLE,STRING,YES,NO,''),
slot(from_user,SINGLE,STRING,YES,YES,''),
slot(to_user,SINGLE,STRING,YES,YES,''),
slot(on_tty,SINGLE,STRING,YES,YES,'')].

See Also

None.

bo_get_enum_options

Gets the elements of an enumeration.

Synopsis

bo_get_enum_options(_enumname, _options)

Description

Unifies a list of the string values that are part of the enumeration _enumname with list _options.

Arguments

_enumname
The name of an enumeration.
_options
The values of the different enumeration options.

Examples

The following example gets a list of all valid values for the SEVERITY enumeration for the event under analysis. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,
         % _class is unified with Su_Success.

  action: (
    bo_get_enum_options('SEVERITY', _options)
    % _options is unified with [UNKNOWN,
    % HARMLESS,WARNING,MINOR,CRITICAL,FATAL]
  )
).

See Also

None.

bo_get_slotval

Gets the value of an attribute from an event.

Synopsis

bo_get_slotval(_event, _attribute, _value)

Description

This predicate gets the value of attribute _attribute in event _event. The value is unified with _value. The value of _value must have the correct type for _attribute for the predicate to succeed.

Arguments

_attribute
The name of the attribute whose value to obtain.
_event
A pointer to the event under analysis.
_value
The value of attribute _attribute.

Examples

The following example gets the value of the sub_source attribute from the event under analysis. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,
         % _class is unified with Su_Success.

  action: (
    bo_get_slotval(_event, 'sub_source',_sub_source)
    % _sub_source is unified with 'su'.
  )
).

See Also

bo_set_slotval

bo_is_defined_for_class

Checks whether an attribute is defined for an event class.

Synopsis

bo_is_defined_for_class(_attribute, _classname)

Description

This predicate succeeds if attribute _attribute is defined in class _classname.

Arguments

_attribute
The attribute to check.
_classname
The event class to check for the attribute definition.

Examples

The following example determines if there is an attribute named pid defined for the event under analysis. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,
         % _class is unified with Su_Success.

  action: (
    bo_is_defined_for_class('pid', _class)
    % Succeeds.
  )
).

See Also

None.

bo_is_direct_super_of

Checks whether an event class is a direct superclass of another event class.

Synopsis

bo_is_direct_super_of(_super_classname, _classname)

Description

Succeeds if _super_classname is a direct superclass of _classname.

Arguments

_classname
The direct subclass of _super_classname.
_super_classname
The direct superclass of _classname.

Examples

The following example determines whether the event under analysis is a direct subclass of the Logfile_Su class. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,
         % _class is unified with Su_Success.

  action: (
    bo_is_direct_super_of('Logfile_Su', _class)
    % This predicate succeeds because
    % 'Logfile_Su' is a 
    % direct superclass of 'Su_Success'.
  )
).

See Also

None.

bo_is_super_of

Checks whether an event class is a superclass of another event class.

Synopsis

bo_is_super_of(_super_classname, _classname)

Description

This predicate succeeds if _super_classname is either a direct or indirect superclass of _classname.

Arguments

_classname
A subclass of _super_classname.
_super_classname
A superclass of _classname.

Examples

The following example determines whether the event under analysis is a subclass of the Logfile_Base class. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,
         % _class is unified with Su_Success.

  action: (
    bo_is_super_of('Logfile_Base', _class)
    % _class was instantiated to 'Su_Success' 
    % in event filter.
    % This predicate succeeds because
    % 'Logfile_Base' is a superclass
    % of 'Su_Success'.
  )
).

See Also

None.

bo_remove_from_slotval

Removes a value from an attribute's list of values.

Synopsis

bo_remove_from_slotval(_event, _attribute, _value)

Description

This predicate removes the value _value from the list of values for attribute _attribute in event _event. This predicate is applicable only if the data type of _attribute is a list.

Arguments

_attribute
The name of an attribute in _event.
_event
A pointer to the event under analysis.
_value
The element to be removed from _attribute.

Examples

The following example removes a value from the acl attribute. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

event: _event of_class _class,
       % _class is unified with Su_Success.

  action: (

    % Before the call, the 'acl' attribute contains [admin].

    bo_add_at_slotval_end(_event, 'acl','senior'),

    % Now the 'acl' attribute contains [admin,senior].

    bo_add_at_slotval_begin(_event, 'acl','user'),

    % Now the 'acl' attribute contains [user,admin,senior].

    bo_remove_from_slotval(_event, 'acl',
     'admin')

    % Now the 'acl' attribute contains [user,senior].
  )
).

See Also

None.

bo_reset_default_slotval

Resets the attribute value for an event to the default value.

Synopsis

bo_reset_default_slotval(_event, _attribute)

Description

This predicate instantiates the default value to attribute _attribute of event _event.

Arguments

_attribute
The name of an attribute in _event. Must be an atom.
_event
A pointer to the event under analysis.

Examples

The following example shows a use of the predicate. This example assumes the event under analysis is an instance of the Su_Success class.

rule: baroc_example: (

  event: _event of_class _class,

  action: (
    bo_reset_default_slotval(_event, 'sub_source')
    % The slot 'sub_source' for the event
    % under analysis is set back to 'su'.
  )
).

See Also

None.

bo_set_slotval

Updates an event attribute value.

Synopsis

bo_set_slotval(_event, _attribute, _value)

Description

This predicate updates the value of attribute _attribute in event _event with value _value.

Unlike the place_change_request predicate, change rules are not evaluated in response to this action.

Also, unlike place_change_request, bo_set_slotval will not automatically update the attribute value in the event database or the event consoles. Often these are updated automatically as part of other rule base activity, such as when the event is initially processed or during a change rule on that event. However, if you are using bo_set_slotval from a change rule on a different event than the current event, the update will not happen. To ensure the attribute is updated everywhere, follow this up with a call to the re_mark_as_modified predicate.

Arguments

_attribute
The attribute to update.
_event
A pointer to the pointer to the event to modify.
_value
The new value to assign the attribute.

Examples

The following example shows how to update the hostname attribute of the event under analysis to the value myhost:

bo_set_slotval(_event, hostname, 'myhost')

See Also

bo_get_slotval, place_change_request, re_mark_as_modified

cancel_all_timers

Cancels all timers that were set on an event.

Synopsis

cancel_all_timers(_event)

Description

This predicate cancels all timers that were set on an event.

Arguments

_event
A pointer to the event on which the timers to cancel were set.

Examples

The following example cancels all timers that were set on an event when a more causal event is received. This example assumes some other rule not shown set the timers when the events were received.

rule: cancel_timers:(

  event: _ev of_class 'EVENT',

  action: cancel_timers:(
    first_effect_event(_ev, _effect, 300, 300),
    link_effect_to_cause(_effect, _ev),
    cancel_all_timers(_effect)
  )
).

See Also

cancel_timer

cancel_timer

Cancels a timer that was set on an event.

Synopsis

cancel_timer(_event, _timer_duration, _timer_info)

Description

This predicate cancels a timer that was set on an event based on any or all of its arguments. The _event argument should be specified whenever possible, though. Arguments not specified must be represented in the call by a variable that is not instantiated or by the Prolog anonymous variable (an underscore character). Variables not instantiated in the call are unified with the corresponding values of the cancelled timer.

Arguments

_event
A pointer to the event whose timer to cancel.
_timer_duration
The duration (in seconds) of the timer. This value was specified when the timer was set. See set_timer additional information.
_timer_info
The timer information. This value was specified when the timer was set. See set_timer additional information.

Examples

The following example performs event correlation and sets a timer for 5 minutes before a trouble ticket is created for an event. The 5 minute delay is intended to provide enough time for any related cause events to arrive so that the trouble ticket is hopefully created for a root cause event rather than a related effect event.

When an event is received, the event cache is searched for related events that have been received within the past 5 minutes. (Related events were defined with the create_event_sequence predicate.) If it's determined that the event under analysis is an effect event of a known cause event found in the cache, it is linked to the cause event and rule processing exits. If a related event is not found for the event under analysis, a timer is set for 5 minutes (to see if related cause events come in) and processing exits.

If a related cause event is received within the 5 minute timer window, the existing timer is canceled, the effect event is linked to the cause event, a new timer is set on the event under analysis, and processing exits.

The create_trouble_ticket rule creates a trouble ticket when the timer expires. This example assumes that the operator has created the appropriate script for their trouble ticketing system in scripts/create_trouble_ticket.sh.

rule: set_timer_delay:(

  event: _ev of_class 'EVENT',

  action: perform_correlation:(
    first_related_event(_ev, _related, _type, 300, 300),
    (
      _type == 'c',
      link_effect_to_cause(_ev, _related),
      commit_set
    ;
     cancel_timer(_related, 300, _info),
     link_effect_to_cause(_related, _ev)
    )
  ), 

  action: set_timer:(
    set_timer(_ev, 300, 0),
    commit_set
  )
).

timer_rule: create_trouble_ticket:(

  event: _ev of_class 'EVENT',
    timer_duration: equals 300,

  action: create_ticket:(
    exec_program(_ev, 'scripts/create_trouble_ticket.sh', '%ld',
                 [_ev], no)
  )
).

See Also

cancel_all_timers

change_event_administrator

Changes the administrator of an event.

Synopsis

change_event_administrator(_event, new_administrator)

Description

This predicate places an internal request to change the administrator attribute of the specified event. This causes the change rules to evaluate the requested change before it is actually applied.

Arguments

_event
A pointer to the event for which the administrator is to be changed.
new_administrator
The new event administrator.

Examples

The following example shows how to change the administrator attribute of the event under analysis to bjones:

change_event_administrator(_event, bjones)

See Also

set_event_administrator

change_event_severity

Changes the severity of an event.

Synopsis

change_event_severity(_event, new_severity)

Description

This predicate places an internal request to change the severity attribute of the specified event. This causes the change rules to evaluate the requested change before it is actually applied.

Arguments

_event
A pointer to the event for which the severity is to be changed.
new_severity
The new event severity.

Examples

The following example shows how to change the severity attribute of the event under analysis to CRITICAL:

change_event_severity(_event, 'CRITICAL')

See Also

set_event_severity

change_event_status

Changes the status of an event.

Synopsis

change_event_status(_event, new_status)

Description

This predicate places an internal request to change the status attribute of the specified event. This causes the change rules to evaluate the requested change before it is actually applied.

Arguments

_event
A pointer to the event for which the status is to be changed.
new_status
The new event status.
Note:
A change from ACK to OPEN status is not valid for the new_status argument.

Examples

The following example shows how to change the status attribute of the event under analysis to ACK:

change_event_status(_event, 'ACK')

See Also

set_event_status

check_all_thresholds

Applies criteria to events to determine if any threshold is exceeded.

Synopsis

check_all_thresholds(_referenceEvent, _name, _count)

Description

This predicate applies criteria to events in the event cache to determine if any threshold has been exceeded. It succeeds once for each threshold that is exceeded. The name of each threshold and the number of events that matched each threshold that is exceeded are unified with the _name and _count arguments, respectively.

Arguments

_count
The number of events that match a threshold. Must be free.
_name
The name of a threshold that is exceeded. This name was assigned with the create_threshold predicate.
_referenceEvent
The reference event to compare with cached events to determine if a threshold is exceeded. This is typically the event under analysis.

Examples

The following example queries the event cache for exceeded thresholds whenever an NT_Performance_Alert event is received:

check_all_thresholds('NT_Performance_Alert', _name,
                     _count)

See Also

check_threshold, create_threshold

check_and_increment_count

Increments a counter and compares it to a threshold value.

Synopsis

check_and_increment_count(_key1, _key2, _max_count, _cur_count)

Description

This predicate first increments a counter and then compares the count to the _max_count argument. If the count is less than _max_count, the predicate succeeds and the count is unified with _cur_count. If the values are equal or the count is greater than _max_count, the predicate fails and _cur_count is not instantiated.

Note:
Creation and initialization of a counter can be done with the init_count predicate, or it can be done with the check_and_increment_count predicate if the counter does not yet exist. If it is done with the check_and_increment_count predicate, the counter is initialized to a value of 0 and incremented by 1 in the first call. Once initialized, a counter continues counting until explicitly reinitialized with a new starting value. You must reinitialize a counter that has reached its threshold if it is still needed for counting.

Counters are used to keep track of any arbitrary numeric value. The values of _key1 and _key2 can be set to easily identify the information being recorded. For example:

If the event server stops, all counters are discarded.

Arguments

_cur_count
The current value the counter. Must be free.
_key1
The primary key name for the counter. Must be instantiated.
_key2
The secondary key name for the counter. Must be instantiated.
_max_count
The threshold value for the count. When this value is reached, the predicate fails. Must be instantiated.

Examples

The following example counts the number of paper jams on a set of printers, based on receiving an event class of Printer_Jam. Printer counters are identified using a failure,component scheme. Printer_Jam events identify each printer in the hostname attribute.

Each counter is created and initialized the first time the check_and_increment_count predicate is called for a particular printer. Each subsequent call for a particular printer increments its count and then compares it to the threshold value.

An administrator is notified when the number of paper jams on a printer reaches 5, and then the count for that printer is reset to 0 using the init_count predicate. The administrator notification and reset of a count is done in an ELSE clause of a Prolog statement because the check_and_increment_count predicate behavior is failure when the count matches the threshold value.

rule: printer_jam: (

  event : _ev of_class 'Printer_Jam'
    where [hostname: _hn within ['flr4rm23',
                                 'flr3rm12',
                                 'flr1rm11',
                                 'flr6rm9'
                                ],

  action: check_count: (
    (check_and_increment_count(printer_jam,_hn,5,_count)
    
    ;
    % ELSE clause follows

    exec_program(_ev,'scripts/notify.sh',
                 'Printer failure on %s', [_hn], no),

    init_count(paper_jam,_hn,0)
    )
  )
).

See Also

init_count

check_event_criteria

Applies criteria to an event instance to determine if the instance meets the criteria.

Synopsis

check_event_criteria(criteria_name, event)

--OR--

check_event_criteria(criteria_names_list, operator, event)

Description

This predicate applies an event criteria created with the create_event_criteria predicate to an event. If the criteria matches, the predicate succeeds.

The second form of the predicate lets you specify multiple event criteria to an event instance.

Arguments

criteria_name
The name of event criteria to apply. This name was assigned with the create_event_criteria predicate.
criteria_names_list
The names of event criteria to apply, in list format. These names were assigned with the create_event_criteria predicate. This argument is specified in list format; for example, [criteria1, criteria2].
event
The name of the event class to apply the criteria.
operator
Specifies how to apply the criteria when a list of named criteria is given. Valid values are:
all
The predicate succeeds only if all of the named criteria are satisfied; that is, if the criteria defined in both criteria1 and criteria2 of the previous example are satisfied, the predicate succeeds.
any
The predicate succeeds if any one of the named criteria is satisfied; that is, if only the criteria defined in criteria2 of the previous example is satisfied, the predicate succeeds.

Examples

  1. The following example rule checks every incoming event for either a heartbeat or maintenance type of event. The event criteria for these events were defined with the create_event_criteria predicate and assigned the names harmless_heartbeat and harmless_maintenance, respectively. If it is either type of event, it is discarded and rule evaluation for the event proceeds with the next rule set.
    rule: filter_event: (
    
      event: _event of_class _class where [ ],
    
      reception_action: check_criteria: (
        check_event_criteria([harmless_heartbeat,
                              harmless_maintenance
                             ],
                             any,
                             _event
                           ),
    
        drop_received_event,
        commit_rule
      )
    ).
  2. The following example applies the criteria defined in example 2 on page 2 for the create_event_criteria predicate on page to the event under analysis.
    check_event_criteria('db_critical', _ev)

See Also

create_event_criteria

check_threshold

Applies criteria to events to determine if a specific threshold is exceeded.

Synopsis

check_threshold(threshold_criteria_name, _referenceEvent, _count)

Description

This predicate applies criteria to events in the event cache to determine if a threshold has been exceeded. The following algorithm is used:

  1. A check is done to evaluate whether the maximum reporting frequency has been exceeded since the last time the threshold was reported. This value was set with the _max_report_freq argument of the create_threshold predicate.
  2. If the maximum reporting frequency has not been exceeded, the check_threshold predicate fails. If the maximum reporting frequency value has been exceeded, a query is made of the event cache. The query searches for all events:
    1. That meet the event cache search criteria (as defined with the create_cache_search_criteria predicate).
    2. Whose reception time is within the time window of threshold criteria (as defined with the _window argument of the create_threshold predicate).
    3. That exceed the threshold specified for the threshold criteria (as defined with the _count argument of the create_threshold predicate).
  3. If a matching event is found, the check_threshold predicate succeeds and the _check_count variable is unified with the number of matching events.

The not operator can be used to reverse the test to check if a threshold was not exceeded.

Arguments

_count
The number of events that match the threshold criteria. Must be free.
_referenceEvent
The reference event to compare with cached events to determine if a threshold is exceeded. This is typically the event under analysis.
threshold_criteria_name
The name of the threshold criteria to apply. This name was assigned with the create_threshold predicate.

Examples

The first part of the following example shows how to define threshold criteria with the create_threshold predicate. Its characteristics are:

The second part of the following example shows how to check threshold criteria with the predicate using the criteria defined in the first part. If 3 events that match the search criteria defined in db_critical_search are found within a 10 minute window of the reception time of the reference event _event, the check_hold predicate succeeds and will not succeed again for at least another 5 minutes.

create_threshold('db_critical_threshold',
                 'db_critical_search',
                 600,
                 3,
                 300)
% Define the threshold criteria.
check_threshold('db_critical_threshold',
                 _event,
                 _count)
% Apply the threshold criteria to received event.

See Also

check_all_thresholds, create_cache_search_criteria, create_threshold

clear_closed_events

Clears closed events from the event cache.

Synopsis

clear_closed_events

Description

This predicate removes closed events from the event cache.

Arguments

None.

Examples

The following example prints the contents of the event cache before and after clearing closed events:

print_cache('/tmp/before'),
clear_closed_events,
print_cache('/tmp/after')

See Also

None.

clears

Defines a clearing event for one or more events in an event sequence.

Synopsis

clears(class, [attribute_conditions], [target_events], [target_attribute_conditions])

--OR--

clears(class, [attribute_conditions], [target_events], [target_attribute_conditions], [attribute_exceptions])

--OR--

clears(class, [attribute_conditions], [target_events], [target_attribute_conditions], create_reverse_lookup)

--OR--

clears(class, [attribute_conditions], [target_events], [target_attribute_conditions], [attribute_exceptions], create_reverse_lookup)

Description

This predicate is used to define a clearing event for one or more events in a sequence and specify which events it clears. It must be called from within the event_details argument of the create_event_sequence predicate.

If the target attribute conditions are already defined with the attribute_conditions argument of the create_event_sequence predicate, the target_attribute_conditions argument should be an the empty list.

Note:
This is a convenience predicate to define clearing events in an event sequence. Any clearing event can be defined with the create_clearing_event predicate, even if the events it clears are specified in one or more event sequences.

Arguments

attribute_conditions
The list of conditions for attributes that must be met by an event to be considered a clearing event. There are two types of conditions, defined as follows:
absolute
A condition that can be placed upon an attribute, similar to an attribute condition in an event filter. For example, if an event of a particular class is designated as a clearing event only if its severity is HARMLESS, then the list of conditions should include [severity,equals,'HARMLESS'].
Note:
Failure to specify absolute conditions can result in problem events being cleared by other problem events rather than clearing events.

See the attribute_conditions argument description for the create_event_criteria for additional details about specifying attribute conditions for this argument, as the syntax is the same.

attribute-match
Names of attributes that must match between correlated events. You should always define at least one attribute-match condition to ensure correlation only between events of the same system. For example, [hostname].
class
The event class of the clearing event.
create_reverse_lookup
Determines whether a reverse lookup record is created for this clearing event. A reverse lookup record enables a rule to search for a problem event's clearing event when the problem event is received (as opposed to the clearing event triggering a search for its problem events, as is typically the case). Valid values for this argument are yes or no. The default is no if this argument is not specified.
target_attribute_conditions
The list of conditions for attributes that must be met by the events listed in the target_events argument for them to be cleared by the clearing event. These conditions should not be defined if they are defined with the attribute_conditions argument of the create_event_sequence predicate.
target_events
The list of event classes that an event of class class clears.

Examples

The following example creates an event sequence for Compaq physical drive events. These events are all of the same class (cpqTape3PhDrvStatusChange). The cpqTapePhyDrvCondition attribute value changes to indicate status, with a value of OK signifying a clearing event.

The clears predicate defines clearing events as class cpqTape3PhyDrvStatusChange with attribute cpqTapePhyDrvCondition set to a value of OK.

create_event_sequence(
  ['cpqTape3PhyDrvStatusChange'],
  ['hostname', ['status','outside',['CLOSED']]]
  [
   attr_sequence(
     'cpqTape3PhyDrvStatusChange',
     'cpqTapePhyDrvCondition'=['Degraded','Failed']),
   clears(
     'cpqTape3PhyDrvStatusChange',
     [ ['cpqTapePhyDrvCondition',equals,'OK'] ],
     ['cpqTape3PhyDrvStatusChange'],
     [ ])
  ]
),

See Also

create_clearing_event , create_event_sequence , is_clearing_event

commit_action

Controls execution within the actions of the current rule.

Synopsis

commit_action

Description

This predicate prevents analysis of any further solutions for previous predicates in the current rule action and prevents the execution of any further actions in the current rule.

Arguments

None.

Examples

The following example shows that the use of the all_instances predicate might have multiple solutions, but only the first solution is used to perform the action. Any actions that follow in the current rule are not performed; however, other rules and rule sets will still evaluate the event under analysis.

reception_action: action1:
   (
   all_instances( _event,
         event: _dup_down_ev
            where [
               status: outside ['CLOSED']
               ],
         _event - 600 - 600
         ),
   add_to_repeat_count(_dup_down_ev, 1),
   drop_received_event,
   commit_action
   ),

See Also

None.

commit_rule

Controls execution within a rule set.

Synopsis

commit_rule

Description

This predicate prevents analysis of any further solutions for previous predicates in the current rule action and prevents the execution of any further actions in the current rule. Additionally, it prevents analysis of any following rules in the current rule set for the event under analysis.

Arguments

None.

Examples

The following example shows that the all_instances predicate might have multiple solutions, but only the first solution is used to perform the rule action. Any actions that follow in the current rule are not performed and any rules that follow the current rule in the current rule set will not evaluate the event under analysis; however, rules in subsequent rule sets will evaluate the event under analysis.

reception_action:
    (
    all_instances( _event,
            event: _dup_toner_ev
                where [
                    status: outside ['CLOSED']
                    ],
            _event - 600 - 600
            ),
    add_to_repeat_count(_dup_toner_ev, 1),
    drop_received_event,
    commit_rule
    ),

See Also

None.

commit_set

Controls execution within a rule base.

Synopsis

commit_set

Description

This predicate prevents the following:

Arguments

None.

Examples

The following example shows that the all_instances predicate might have multiple solutions, but only the first solution is used to perform the rule action. Any actions that follow in the current rule are not performed and any rules that follow the current rule in the entire rule base will not evaluate the event under analysis.

reception_action:
   (
   all_instances( _event,
   event: _dupper
   where [
      status: outside ['CLOSED']
      ]),
   drop_received_event,
   add_to_repeat_count(_dupper, 1),
   commit_set
   ),

See Also

None.

convert_ascii_time

Converts a time structure to an atom.

Synopsis

convert_ascii_time(_time_structure, _time_string)

Description

This predicate converts a time structure to an atom representing the time. _time_structure must be instantiated before calling convert_ascii_time. _time_string must be free.

Arguments

_time_string
The atom representation of _time_structure.
_time_structure
Represents an internal time structure. Do not confuse it with the data returned by the get_time predicate, in which the value for the _time_epoch argument is a number representing how many seconds have passed since an epoch.

Examples

The following example shows how to get the current time structure from the local system, convert the time structure to a string, and update the time_string attribute of the event with the string.

get_local_time(_time_local_struct),
convert_ascii_time(_time_local_struct, _time_string),
bo_set_slotval(_event, time_string, _time_string)

See Also

bo_set_slotval, get_local_time

convert_gm_time

Converts an epoch time number to a time structure in Greenwich mean time (GMT).

Synopsis

convert_gm_time(_time_epoch, _time_gm_struct)

Description

This predicate converts an epoch time number to a time structure in GMT. _time_epoch must be instantiated before calling convert_gm_time. _time_gm_struct must be free.

Arguments

_time_epoch
Represents an epoch time number. Do not confuse it with the data returned by the get_local_time predicate, in which the value for the _time_local_struct argument is a time structure.
_time_gm_struct
Represents a time structure in GMT. Do not confuse it with the data returned by the get_time predicate, in which the value for the _time_epoch argument is a number representing how many seconds have passed since an epoch.

Examples

The following example shows how to:

  1. Get the epoch time number.
  2. Update the time_epoch attribute for the event.
  3. Convert the epoch time number to a GMT structure.
  4. Convert the GMT structure to a string.
  5. Update the time_string attribute of the event with the string.

The time_epoch attribute could then be used for comparisons and the time_string attribute could be used for viewing by a person.

get_time(_time_epoch),
bo_set_slotval(_event, time_epoch, _time_epoch),
convert_gm_time(_time_epoch, _time_gm_struct),
convert_ascii_time(_time_gm_struct, _time_string),
bo_set_slotval(_event, time_string, _time_string)

See Also

bo_set_slotval, convert_ascii_time, get_time

convert_local_time

Converts an epoch time number to a time structure in local system time.

Synopsis

convert_local_time(_time_epoch, _time_local_struct)

Description

This predicate converts an epoch time number to a time structure in local system time. _time_epoch must be instantiated before calling convert_local_time. _time_local_struct must be free.

Arguments

_time_epoch
Represents an epoch time number. Do not confuse it with the data returned by the get_local_time predicate, in which the value for the _time_local_struct argument is a time structure.
_time_local_struct
Represents a time structure in local system time. Do not confuse it with the data returned by the get_time predicate, in which the value for the _time_epoch argument is a number representing how many seconds have passed since an epoch.

Examples

The following example shows how to:

  1. Get the epoch time number
  2. Update the time_epoch attribute for the event.
  3. Convert the epoch time number to a local system time structure.
  4. Convert the local system time structure to a string.
  5. Update the time_string attribute of the event with the string.

The time_epoch attribute could then be used for comparisons and the time_string attribute could be used for viewing by a person.

get_time(_time_epoch),
bo_set_slotval(_event, time_epoch, _time_epoch),
convert_local_time(_time_epoch, _time_local_struct),
convert_ascii_time(_time_local_struct, _time_string),
bo_set_slotval(_event, time_string, _time_string)

See Also

bo_set_slotval, convert_ascii_time, get_time

create_cache_search_criteria

Defines a named search for an event cache query.

Synopsis

create_cache_search_criteria(search_name, criteria_name, attributes, dup_detect)

--OR--

create_cache_search_criteria(search_name, criteria_name, attributes, dup_detect, returnOrder)

Description

This predicate defines named searches for querying the event cache. It is used in conjunction with:

The second form of the predicate lets you specify a logical order for returning events when multiple events were defined in the event criteria. For example, if order was not defined and the event classes were specified in the event criteria as [A,B,C,D,E], the events found in the cache would be returned as they were located during the search; that is, if a C event was found first because it was the most recent, it would be returned first, if an E event was then found, it would be returned next, and so forth. If you specified to return the events in order, all class A events would be returned as they were found, then all class B events would be returned as they were found, and so forth. Specifying order of return can make it easier for you to develop rules that identify the root cause of a problem.

This predicate should be run in a rule triggered by a TEC_Start event at event server start-up time. This loads the named search once, instead of every time it is needed.

Arguments

attributes
The attribute names to match with those of the reference event, typically the event under analysis. This argument is specified in list format; for example, [hostname,severity].
criteria_name
The name that uniquely identifies the event class and attribute conditions for the search. The criteria must be created with the create_event_criteria predicate.
dup_detect
Indicates whether to apply duplicate detection as a condition of the query. Valid values are:
no
Do not apply duplicate detection as a condition of the query.
yes
Apply duplicate detection as a condition of the query.
return_order
Indicates whether to return events in the class order defined in the event criteria for the search. If this argument is not specified, the default is random. Valid values are:
order
Return events in the class order defined in the event criteria for the search
random
Return events in the order found.
search_name
The name to uniquely identify the search. This name is used by the search_cache predicate.

Examples

The following example creates a search named db_critical_search, which uses the event criteria named db_critical. This search finds any event that passes the db_critical event criteria and whose hostname attribute is the same value as the reference event. The return_order argument has been omitted and therefore defaults to random, meaning events in the list are returned in the order found during the search.

create_cache_search_criteria('db_critical_search',
                             'db_critical',
                             ['hostname'],
                              yes
)

See Also

create_event_criteria, search_cache

create_clearing_event

Defines a clearing event.

Synopsis

create_clearing_event(class, [attribute_conditions], [target_events], [target_attribute_conditions])

--OR--

create_clearing_event(class, [attribute_conditions], [target_events], [target_attribute_conditions], [attribute_exceptions])

--OR--

create_clearing_event(class, [attribute_conditions], [target_events], [target_attribute_conditions], create_reverse_lookup)

--OR--

create_clearing_event(class, [attribute_conditions], [target_events], [target_attribute_conditions], [attribute_exceptions], create_reverse_lookup)

Description

This predicate is typically used to define a clearing event for one or more problem events that are not part of an event sequence.

This predicate can be used to define any clearing event, even if the events it clears are specified in one or more event sequences.

Arguments

attribute_conditions
The list of conditions for attributes that must be met by an event to be considered a clearing event.There are two types of conditions, defined as follows:
absolute
A condition that can be placed upon an attribute, similar to an attribute condition in an event filter. For example, if an event of a particular class is designated as a clearing event only if its severity is HARMLESS, then the list of conditions should include [[severity,equals,'HARMLESS']].

Under typical circumstances, you only need to specify absolute conditions. Attribute-match conditions are evaluated only in the extremely rare case of when clearing events have been received before problem events arrive and a reverse lookup is needed for correlation.

Note:
Failure to specify absolute conditions can result in problem events being cleared by other problem events rather than clearing events.

See the attribute_conditions argument description for the create_event_criteria for additional details about specifying attribute conditions for this argument, as the syntax is the same.

attribute-match
Names of attributes that must match between correlated events; for example, [hostname]. These conditions are evaluated only in the extremely rare case of when clearing events have been received before problem events arrive and a reverse lookup is needed for correlation.
attribute_exceptions
Identifies an attribute that must match an attribute with a different name in other events in an event sequence. This argument enables event correlation between events containing attributes with different names but the same meaning. For example, Tivoli Distributed Monitoring might assign the name of an affected machine to the probe_arg attribute of an event.

Other monitoring systems might send events containing the name of an affected machine in the hostname attribute. To correlate these events based on machine names, map the two attributes to each other using the attribute_exceptions argument.

The attr_exception rule language predicate is used to defined the attribute_exceptions argument. See attr_exception for additional details.

class
The event class of the clearing event.
create_reverse_lookup
Determines whether a reverse lookup record is created for this clearing event. A reverse lookup record enables a rule to search for a problem event's clearing event when the problem event is received (as opposed to the clearing event triggering a search for its problem events, as is typically the case). Valid values for this argument are yes or no. The default is no if this argument is not specified.
target_attribute_conditions
The list of conditions for attributes that must be met by the events listed in the target_events argument for them to be cleared by the clearing event. There might be absolute conditions specified, but there should at least be on attribute-match condition specified to ensure that clearing events only clear problem events from the same system.
target_events
The list of event classes that an event of class class clears.

Examples

  1. The following example defines a clearing event for a CiscoLinkDown event, assuming that the value of the origin attribute is the same between the two events. A reverse-lookup record is not created because it is not possible to receive a CiscoLinkUp event before a corresponding CiscoLinkDown event.
    create_clearing_event('CiscoLinkUp',
                          [ ],
                          ['CiscoLinkDown'],
                          ['origin'],
                          no)
  2. The following example defines a clearing event for a cpqDa3PhyDrvStatusChange event. The cpqDaPhyDrvStatus attribute of this event can have a value of Fail to indicate a problem or a value of OK to clear a problem, assuming the value of the hostname attribute is the same between the two events.

    The event class of the clearing event is also specified in the target_events argument because this clearing event clears events of the same class but with a different attribute value.

    create_clearing_event(
      'cpqDa3PhyDrvStatusChange', 
      [ ['cpqDaPhyDrvStatus',equals,'OK'] ],
      ['cpqDa3PhyDrvStatusChange'],
      ['hostname',['cpqDaPhyDrvStatus',not_equals,'OK'] ],
      no),

See Also

clears , create_event_sequence , is_clearing_event

create_event_criteria

Specifies criteria for an event.

Synopsis

create_event_criteria(criteria_name, class, fire_on_non_leaf, attribute_conditions)

Description

This predicate defines criteria used for determining the state of an event. Criteria are used where needed in any rule action by the check_event_criteria predicate, and are also used by the create_cache_search_criteria predicate.

This predicate should be run in a rule triggered by a TEC_Start event at event server start-up. This loads the criteria once, instead of every time it is needed.

The following checks are done at runtime to this predicate. Errors can be obtained with the log_error predicate, which is described on page log_error.

Arguments

attribute_conditions
Specifies the attribute conditions for the reference event. Each attribute condition is defined as a list with three elements. The attribute_conditions argument is a list of attribute conditions, which means it is a list of lists. For example, the following figure illustrates the format of this argument if two attribute conditions are defined:
[['attribute', operator, 'value'],
['attribute, operator, 'value']]
Notes:
  1. The attribute and operator must be compatible. For example, you cannot create a condition for an attribute defined as a STRING type with a greater_than operator. See the following table for attribute-operator compatibility.
  2. Attribute conditions can only be defined for attributes of a SINGLE complexity type.
  3. The matches operator requires the same Perl regular expression syntax as that supported by the Tivoli Management Framework.
  4. ENUM types are evaluated arithmetically based on their integer representation.
  5. Attributes of a LIST_OF complexity type are not supported in an attribute condition.
The following table lists the operators you can use for each SIMPLE type of attribute. The operators used in this predicate are similar to those used in an event filter. As such, you might find the information in Attribute conditions helpful.
Simple Type Operator
ENUM, INTEGER, REAL equals greater_than greater_than_equal less_than less_than_equal not_equals outside within
STRING equals not_equals matches outside within
class
The event classes for which the attribute conditions are defined. This argument is specified in list format; for example, ['NT_SNMP', 'NT_Server_Start'].

The order of event classes in the list is significant if you use the return_order argument with a value of order in the create_cache_search_criteria predicate when defining a search using this event criteria. See the create_cache_search_criteria for additional information.

criteria_name
The name that uniquely identifies the criteria.
fire_on_non_leaf
Specifies whether the criteria can be used for executing rules on the reference event if it is a superclass. The following values are valid:
no
The criteria can be used for executing rules on leaf classes only.
yes
The criteria can be used for executing rules on both leaf and non-leaf classes.

Examples

  1. The following example shows how to define event cache search criteria with the predicate. The name of this criteria is example_criteria. This is the name referred to from the create_cache_search_criteria predicate. This criteria is used for a TEC_DB event and it can only be used for a leaf class.

    Note:
    This example is not a realistic definition. It is simply intended to show the various ways you can define attribute conditions.
    create_event_criteria(example_criteria,
      'TEC_DB',
      no, 
      [['hostname', equals, 'chair' ],
       ['hostname', not_equals, 'chair1' ],
       ['hostname', matches, 'ch.*r' ],
    
       ['repeat_count', within, [5]],
       ['repeat_count', outside, [10,15]],
       ['repeat_count', equals, 5],
       ['repeat_count', not_equals, 6],
       ['repeat_count', greater_than, 4],
       ['repeat_count', greater_than_equal, 5],
       ['repeat_count', less_than, 6],
       ['repeat_count', less_than_equal, 5],
    
       ['severity', within, ['MINOR']],
       ['severity', outside, ['FATAL','HARMLESS']],
       ['severity', equals, 'MINOR'],
       ['severity', not_equals, 'FATAL'],
       ['severity', greater_than, 'HARMLESS'],
       ['severity', greater_than_equal, 'MINOR'],
       ['severity', less_than, 'CRITICAL'],
       ['severity', less_than_equal, 'CRITICAL']
      ]
    ),
  2. The following example creates event criteria named db_critical. This criteria applies to a TEC_DB event sent from a database server with a severity greater than or equal to CRITICAL. The severity attribute is defined as an ENUM type with a default value of 60. This example assumes all database server names begin with DB_SRV followed by other characters.
    create_event_criteria('db_critical',
                          'TEC_DB'
                           yes,
                          [['hostname',matches,
                            'DB_SRV*'],
    
                           ['severity',
                            greater_than_equal,
                            'CRITICAL']
                          ]
    )
  3. The following example creates event criteria named ups_problem. This criteria applies to any upsOnBattery, upsBatteryLow, or upsBatteryDischarged event from host homer.
    create_event_criteria('ups_problem',
                          ['upsOnBattery',
                           'upsBatteryLow',
                           'upsBatteryDischarged'],
                           yes,
                          [['hostname',equals,'homer']]
    )

See Also

check_event_criteria, create_cache_search_criteria

create_event_sequence

Defines a sequence of events for correlation.

Synopsis

create_event_sequence([event_sequence], [attribute_conditions])

--OR--

create_event_sequence([event_sequence], [attribute_conditions], [event_details])

Description

This predicate is used to define a sequence of events, and any additional information pertaining to those events, that make up an event sequence. An event sequence is a series of events (generally causally related) that occur in a fixed order.

This information is loaded into the knowledge base of the rule engine at event server start-up and is used by rules that call correlation predicates. You can load it with a rule triggered by a TEC_Start event at event server start-up time.

Arguments

attribute_conditions
The list of conditions for attributes that must be met by both events in a sequence (the event under analysis and the event being searched for in the cache) to be eligible for correlation. There are two types of conditions, defined as follows:
absolute
A condition that can be placed upon an attribute, similar to an attribute condition in an event filter. For example, [severity,equals,'HARMLESS']. This type of condition applies to all events in the event sequence. Any absolute conditions that apply to only a subset of events in an event sequence must be specified with the attr_condition predicate, which is described on page attr_condition .

See the attribute_conditions argument description for the create_event_criteria for additional details about specifying attribute conditions for this argument, as the syntax is the same.

attribute-match
Names of attributes whose values must match between correlated events. You should always define at least one attribute-match condition to ensure correlation only between events of the same system. For example, [hostname]. This type of condition applies to both events that are being correlated when using the attr_exception predicate in this argument. The attr_exception predicate is described on page attr_exception .
event_details
The list of predicates that provides additional details about individual events in the event sequence, including identifying clearing events. The predicates that can be specified are shown in the following table.

Predicate
Description
attr_condition Defines absolute attribute conditions for a single event in an event sequence.
attr_exception Defines an attribute that must match a different attribute in other events in an event sequence.
attr_sequence Defines the values of an attribute that change due to a problem event's position in an event sequence.
clears Defines a clearing event for events in an event sequence.
event_sequence
The list of event class names in event-sequence order, from left to right. For example, ['upsOnBattery', 'lowBattery', 'upsDischarged'].

Examples

  1. The following example defines an event sequence with clearing events. The sequence contains events generated from two monitoring sources: APC uninterruptible power supply and IBM Tivoli Distributed Monitoring. The uninterruptible power supply event sequence is illustrated in the figure on page ***.

    The problem events are specified in event-sequence order, from left to right, the root cause being the upsOnBattery event. The last event in the sequence (universal_host) is generated by Tivoli Distributed Monitoring. Each of the problem events in the sequence has a related clearing event defined with the clears predicate. The uninterruptible power supply events are related if the hostname attributes have the same value.

    The Tivoli Distributed Monitoring universal_host event is handled a little differently because the value for the affected host is stored in the probe_arg attribute (rather than the hostname attribute like the uninterruptible power supply events). This requires mapping of the probe_arg attribute to the hostname attribute of the uninterruptible power supply events so correct comparisons can be made. A situation like this is referred to as an attribute exception and requires the use of the attr_exception predicate, which is called from the event_details argument of the create_event_sequence predicate.

    A universal_host event with a severity of FATAL is generated when a host is unavailable. When the host is available again, the same event is sent with a severity of HARMLESS. This situation means that two events of the same class are differentiated by the value of an attribute. This requires the use of the attr_condition predicate in the event_details argument of the create_event_sequence predicate to define that a universal_host event is only to be correlated with an uninterruptible power supply event if its severity is FATAL. Furthermore, a universal_host event is a clearing event only of its severity is HARMLESS.

    The attribute_conditions argument for the first three clears predicates in the example are empty lists because the clearing events are event classes and attribute conditions are not needed. Their hostname attributes must match because hostname is specified in the attribute_conditions argument for the create_event_sequence predicate.

    The attribute_conditions argument for the fourth clears predicate places a condition on the universal_host event's severity attribute for the value being equal to HARMLESS for defining a clearing event. The specification of the hostname attribute in the attribute_conditions argument for the create_event_sequence predicate and the attr_exception predicate called from the event_details argument of the create_event_sequence predicate ensure that the host names match between clearing and problem events.

    create_event_sequence(
      ['upsOnBattery',
       'lowBattery',
       'upsDischarged',
       'universal_host'],
    
      ['hostname', ['status','outside',['CLOSED']]
      [
       clears('powerRestored',[ ], ['upsOnBattery'],[ ]),
       clears('returnFromLowBattery',[ ],['lowBattery'],
              [ ]),
       clears('dischargeCleared',[ ],['upsDischarged'],
              [ ]),
       clears('universal_host', 
              [ ['severity', equals,'HARMLESS'] ]
              ['universal_host'], 
              [ ]),
       attr_condition('universal_host',
                      ['severity',equals,'FATAL']),
       attr_exception('hostname','universal_host',
                      'probe_arg')
      ]
    ),
  2. The following example defines an event sequence with clearing events. This sequence contains events generated from Compaq Insight Manager related to physical drive problems. This event sequence is illustrated in the figure on page ***.

    This monitor generates events of the same class, using the cpqTapePhyDrvCondition attribute to indicate status. This attribute with a value of OK designates a clearing event. To handle this type of event sequence, the attribute name and the sequence of values (in event-sequence order from left to right) it can assume must be defined with the attr_sequence predicate, which is called from the event_details argument of the create_event_sequence predicate.

    The event_sequence argument only defines one class because this one event comprises the entire event sequence. Status is dependent upon the cpqTapePhyDrvCondition attribute.

    In the clears predicate, a target_attribute_conditions argument is not needed because the conditions for the problem events are already defined with the attr_sequence predicate.

    create_event_sequence(
      ['cpqTape3PhyDrvStatusChange'],
      ['hostname', ['status','outside',['CLOSED']]]
      [
       attr_sequence(
         'cpqTape3PhyDrvStatusChange',
         'cpqTapePhyDrvCondition'=['Degraded','Failed']),
       clears(
         'cpqTape3PhyDrvStatusChange',
         [ ['cpqTapePhyDrvCondition',equals,'OK'] ],
         ['cpqTape3PhyDrvStatusChange'],
         [ ])
      ]
    ),
  3. This example is based upon the event sequence defined in the following figure. It defines an event sequence with sequences that branch. This means that two or more sequences merge or emerge from a single sequence. In this example, the cpqHe3ThermalSystemFan and the cpqHe3ThermalCpuFan type of events merge with the cpqHe3ThermalTemp event type sequence. This event sequence contains events generated from Compaq Insight Manager that are related to temperature problems. Root cause events are the darkest shade, clearing events are the next lightest, and effect events are the lightest.
    Branching Causal Chain

    The create_event_sequence predicate can be used to define this type of event sequence by specifying one complete sequence with subsequent sequences that include at least one of the events that all of the related sequences have in common.

    If a sub-sequence branches from the complete sequence and then reconnects later in the sequence, both the event where it branched and the event where it reconnected must be specified. You should specify the complete sequence first and then specify sub-sequences that branch from or connect to it; this approach will make it easier for you to write the predicates.

    The following two create_event_sequence predicates completely define the event sequence shown in the flowchart for this example. The cpqHe3ThermalTempDegraded event in the second predicate specifies that the cpqHe3ThermalCpuFanFailed event joins the sequence defined in the first predicate.

    create_event_sequence(
      ['cpqHe3ThermalSystemFanDegraded',
       'cpqHe3ThermalSystemFanFailed'
       'cpqHe3ThermalTempDegraded',
       'cpqHe3ThermalTempFailed'],
    
      [hostname, ['status', equals, 'OPEN']],
    
      [
       clears('cpqHe3ThermalSystemFanOK', 
              [ ],
              ['cpqHe3ThermalSystemFanDegraded], 
              [ ]),
    
       clears('cpqHe3ThermalTempOK', 
              [ ],
              ['cpqHe3ThermalTempDegraded], 
              [ ]),
    
       clears('cpqHe3ThermalConfirmation', 
              [ ],
              ['cpqHe3ThermalTempFailed], 
              [ ])
      ]
    ),
    
    create_event_sequence(
      ['cpqHe3ThermalCpuFanFailed',
       'cpqHe3ThermalTempDegraded'],
    
      [hostname, ['status', equals, 'OPEN']],
    
      [
        clears('cpqHe3ThermalCpuFanOK', 
               [ ],
               ['cpqHe3ThermalSystemFanFailed], 
               [ ])
      ]
    ),

See Also

None.

create_threshold

Defines a threshold.

Synopsis

create_threshold(threshold_criteria_name, cache_search_criteria_name, _window, _count, _max_report_frequency)

Description

This predicate defines the criteria for setting a threshold for events in the event cache. It is used in conjunction with the check_threshold predicate. It should be run in a rule triggered by a TEC_Start event at event server start-up time. This loads the criteria once.

Arguments

_count
Specifies the threshold. For example, a threshold of 5 means that when the sixth matching event is found, the threshold has been exceeded.
_max_report_frequency
Specifies the time, in seconds, that a threshold has to remain exceeded before the threshold is reported again as exceeded.
_window
Specifies the time window, in seconds, to count events that match the search criteria towards the threshold. The time window is based upon the reception time of the reference event, which is typically the event under analysis. The time window spans the number of seconds before and after the reference event. For example, a time window of 600 seconds (10 minutes) means that events matching the search criteria received 5 minutes before or 5 minutes after the reference event are counted towards the threshold.
cache_search_criteria_name
The name that uniquely identifies the search criteria for a query of the event cache. This criteria was created with the create_cache_search_criteria predicate. The search criteria must be defined before using the create_threshold predicate.
threshold_criteria_name
The name that uniquely identifies the threshold criteria. This name is referred to from the check_threshold predicate.

Examples

The following example shows how to define threshold criteria with the predicate. Its characteristics are:

create_threshold('db_critical_threshold',
                 'db_critical_search',
                 600,
                 3,
                 300)

See Also

check_threshold, create_cache_search_criteria

decrement_slot

Subtracts a number from the value of the specified integer attribute.

Synopsis

decrement_slot(_event, _attribute_name, _by_value, _trigger)

Description

This predicate subtracts a number from the value of the specified integer attribute.

Note:
Generally, the term slot has been replaced by the term attribute, even though this command name has not been changed.

Arguments

_attribute_name
The attribute to change.
_by_value
The amount to subtract.
_event
A pointer to the event to change.
_trigger
Specifies whether change rules should be evaluated as a result of this attribute change. Valid values are: 'YES', yes, 'NO', or no.

Examples

The following example shows predicate usage:

decrement_slot(_event,host_down,1,no)

See Also

increment_slot

drop_change_request

Prevents a change request from being applied after change rules are run.

Synopsis

drop_change_request

Description

This predicate prevents a change request from being applied after change rules are run.

Arguments

None.

Examples

The following example shows that for a request to change the status of an event to ACK or CLOSED, if the requesting user is not Root-myHost-region, the change request is dropped and the msg attribute of the event is set to a denial message. The change request is not evaluated by any other change rules after being dropped.

change_rule: deny_state_change_of_TTs:(
       event: _event of_class _class,
       sender: _sender equals operator(_x),
       slot: status set_to _new_status within ['ACK', 'CLOSED'],
 action: (
  _sender \==  operator('Root_myHost-region'),
  bo_set_slotval(_event,'msg','modification denied !'),
  drop_change_request
 )
).

See Also

None.

drop_received_event

Discards an event after the rules are run.

Synopsis

drop_received_event

Description

This predicate causes the event under analysis to be discarded after the rules are evaluated with it.

Arguments

None.

Examples

The following example rule shows how to count the number of duplicate NFS_NOT_RESPONDING events that are received and then drop them so they're not stored in the event database. This results in one event kept with its repeat_count attribute updated each time a duplicate is received.

rule: dup_nfs_not_resp:(

  event: _event of_class 'NFS_NOT_RESPONDING',

  action: dup_and_drop_event:(
    first_duplicate(_event,event: _dup_nfs_ev
                    where [status: outside ['CLOSED'] ]
    ),

    add_to_repeat_count (_dup_nfs_ev, 1),

    drop_received_event
  )
).

See Also

None.

erase_globals

Removes all the global variables in a group from the knowledge base.

Synopsis

erase_globals(_group)

Description

This predicate removes all the global variables in a group from the knowledge base.

Arguments

_group
The group key whose variables to remove.

Examples

The following example removes all of the global variables in the Maintenance group from the knowledge base:

erase_globals('Maintenance')

See Also

None.

exec_program

Launches a program.

Synopsis

exec_program(_event, file_name, _format_string, _arg_list, watch_status)

Description

This predicate launches a program. The program's completion status can be monitored.

Note:
Null arguments to exec_program might crash the event server when this predicate is run. In addition, ensure that all attributes passed to exec_program are instantiated.

Arguments

_arg_list
A list of values (typically attributes of the event) to be supplied to the program in the form [1, 2, 3]. All of the attributes of the trigger event are also available to the program through environment variables; for example, the msg attribute value can be obtained from the $msg environment variable. See the IBM Tivoli Enterprise Console Command and Task Reference for additional information about environment variables available to running tasks and programs

For every format specification in the format string, there must be a corresponding element in the argument list. The data types in the format string must be compatible with their corresponding values in the argument list. If there are no format specifications in the format string, the argument list must be an empty list, written as [ ]. The length of a formatted command line is limited to 256 characters.

_event
A pointer to the event that triggers running of the program. All attributes of this event are available to the program as environment variables. See the IBM Tivoli Enterprise Console Command and Task Reference for additional information about environment variables available to running tasks and programs.
_format_string
The format string for formatting arguments to the command. %s (STRING), %d (INTEGER), and %ld (INT32) format specifications can be defined in the format string for use with the corresponding values in the argument list.
file_name
The path and file name of the program to run. Relative paths can be specified from the $BINDIR/TME/TEC directory.
watch_status
Specifies whether program execution should be monitored. The watch_status argument can be 'YES' or 'NO'. This argument must be enclosed in single quotation marks. If 'YES', the completion status command can be checked from the event console.

Examples

The following example shows a use of the predicate:

exec_program(_event,
            % Pass in the event pointer for access to
            % its environment variables.

            'scripts/send_notice',
            % Program path/name.

            '-m "%s" -s %s',
            % Format string.

            [_msg, _severity],
            % Argument list.

            'YES')
            % Watch status.
)

The %s format specifiers of the _format_string argument are bound to the msg and severity attributes of the event. The send_notice program is launched with four command line arguments, such as shown in following example:

send_notice -m "Su to root failed for Joe" -s CRITICAL

Note that double quotation marks are used to delimit the value of the msg attribute so it is presented as a single argument to the send_notice command.

See Also

exec_program_local, exec_task, exec_task_local

exec_program_local

Launches a program on the local event server.

Synopsis

exec_program_local(_name, _event, file_name, format_string, _arg_list, watch_status)

Description

This predicate launches a program asynchronously on the local event server (local means the server where the rule engine is installed). When the program finishes, a TASK_COMPLETE event is generated if the watch_status argument is set to 'YES'. This event contains details about the program's execution. The TASK_COMPLETE event class is defined in the tec.baroc file. A description of its attributes are as follows:

command
The name of the command to launch the program.
end_time
The time when the program finished.
execution_msg
Output from the program. This attribute contains a list of strings, each string representing a line of output from the program or script. This list is limited to 512 lines.
exit_status
The exit status set by the operating system for the program.
start_time
The time when the program started.
task_name
The name assigned to the program. It was assigned with the _name argument of the predicate.
task_number
An identifier for the executing program. These identifiers start at 1 and are incremented by 1 for each launch of a program.
task_status
The completion status for the program.
trigger_event_id
The identifier of the event that triggered the launch of the exec_program_local predicate.

Usually a pair of rules are created when using this predicate. The first rule launches the program. The second rule evaluates the results of the program when it is done and might take some action depending on the results.

Arguments

_arg_list
A list of values (typically attributes of the event) to be supplied to the program in the form [1, 2, 3]. All of the attributes of the trigger event are also available to the program through environment variables; for example, the msg attribute value can be obtained from the $msg environment variable. See the IBM Tivoli Enterprise Console Command and Task Reference for additional information about environment variables available to running tasks and programs.

For every format specification in the format string, there must be a corresponding element in the argument list. The data types in the format string must be compatible with their corresponding values in the argument list. If there are no % format specifications in the format string, the argument list must be an empty list, written as [ ]. The length of a formatted command line is limited to 256 characters.

_event
A pointer to the event that triggers running of the program. All attributes of this event are available to the program as environment variables. See the Tivoli Management Framework Reference Manual for additional information about environment variables available to running tasks and programs.
_format_string
The format string for formatting arguments to the command. %s (STRING), %d (INTEGER), and %ld (INT32) format specifications can be specified in the format string for use with the corresponding values in the argument list. If a format string is not specified, an empty _format_string argument must be specified in the form '' (two single quotation marks). The example in exec_program shows the use of format strings.
_name
The name to assign the program. It is used to identify the program in a TASK_COMPLETE event.
file_name
The path and file name of the program to run. Relative paths can be specified from the $BINDIR/TME/TEC directory.
watch_status
Specifies whether a TASK_COMPLETE event is to be generated. Valid values are:
'NO'
Do not generate a TASK_COMPLETE event when the program finishes. This argument must be enclosed in single quotation marks.
'YES'
Generate a TASK_COMPLETE event when the program finishes. This argument must be enclosed in single quotation marks.

Examples

The following example shows:

  1. In the program_start rule, the ls (list) program is launched upon the reception of a TEC_DB event. The program is launched with the following characteristics:
    • The program is given the name of list_tmpdir.
    • There are no additional arguments for the program's command line.
    • A TASK_COMPLETE event is to be generated when the program finishes.
  2. The program_result rule is triggered by the reception of a TASK_COMPLETE event with the task_name attribute set to list_tmpdir, which is the name of the program invoked in the previous rule.
  3. The process_program_result action of the program_result rule does the following:
    1. Gets the value of the execution_msg attribute from the TASK_COMPLETE event and unifies that value with the _results variable. This attribute is a list of strings.
    2. _results is searched for an element with a value of OK.
    3. If an element with a value of OK is found in the list, the ok predicate is run. If it is not found, the not_ok predicate is run.
rule:  program_start: (

  event: _event of_class  'TEC_DB'
    where [  ],

  reception_action: start_it: (
    exec_program_local('lst_tmpdir',_event,'ls /tmp',
                       '',[ ],'YES')  
  )
).

rule:  program_result: (

  event: _event of_class  'TASK_COMPLETE'
    where [task_name: _task_name equals 'lst_tmpdir',
           % Test for program name. If passed, assign
           % value to variable.

           task_number: _task_num
           % Assign task_number attribute value to
           % variable.
    ],

  reception_action: process_program_result: (

    bo_get_slotval(_event,execution_msg,_results),
    % Get value of execution_msg attribute and assign to
    % variable. Attribute is a list type.

    member(_result_line,_results),
      (_result_line == 'OK'  ->
      % Test each element for OK value.

          ok
          % OK value found in list. Run ok predicate.

        ;     % Else.

          do_not_ok_thing
         % OK value not found in list. Run not_ok
         % predicate.)
  ) 
).

See Also

exec_program, exec_task, exec_task_local

exec_task

Launches a task from a task library.

Synopsis

exec_task(_event, task_name, format_string, _arg_list, watch_status)

Description

This predicate launches a task from a task library. The task's completion status can be monitored. Tasks provided by the Tivoli Enterprise Console product are described in the IBM Tivoli Enterprise Console Command and Task Reference.

Note:
Null arguments to exec_task might crash the event server when this predicate is run. In addition, ensure that all attributes passed to exec_task are instantiated.

Arguments

_arg_list
A list of values (typically attributes of the event) to be supplied to the program in the form [1, 2, 3]. All of the attributes of the trigger event are also available to the program through environment variables; for example, the msg attribute value can be obtained from the $msg environment variable. See the IBM Tivoli Enterprise Console Command and Task Reference for additional information about environment variables available to running tasks and programs.

For every format specification in the format string, there must be a corresponding element in the argument list. The data types in the format string must be compatible with their corresponding values in the argument list. If there are no format specifications in the format string, the argument list must be an empty list, written as [ ]. The length of a formatted command line is limited to 256 characters.

_event
A pointer to the event that triggers running of the program. All attributes of this event are available to the program as environment variables. See the Tivoli Management Framework Reference Manual for additional information about environment variables available to running tasks and programs.
_format_string
The format string for formatting arguments to the task. %s (STRING), %d (INTEGER), and %ld (INT32) format specifications can be specified in the format string for use with the corresponding values in the argument list. The format string contains the name of the task library, the host name where the task will run, and any command line arguments to the task in the following form:
-l tasklibname -h hostname -a arg1 -a arg2...
The example in exec_program shows the use of format strings.
Notes:
  1. The -l, -h, and -a arguments in the format string are the same as those used in the Tivoli Management Framework wruntask command. See the Tivoli Management Framework Reference Manual for details.
  2. The task name (-t TaskName) and pass environment variables (-E) wruntask command arguments are provided internally by the exec_task predicate.
task_name
Specifies the name of the task to run.
watch_status
Specifies whether task execution should be monitored. The watch_status argument can be 'YES' or 'NO'. This argument must be enclosed in single quotation marks. If 'YES', the completion status command can be checked from the event console.

Examples

  1. The following example shows that the Send_Email task from the T/EC Tasks library is launched on host stumpy. Two arguments are passed to the task: the administrator's name to appear in the To field of the note, and the administrator's e-mail address. Task completion will not be monitored. The wruntask command example shows how the task is actually launched with the arguments resolved.
    exec_task(_event,
      'Send_Email',
      '-l "T/EC Tasks" -h "stumpy" -a "%s" -a "%s"',
      ['joe@company.com', 'joe@company.com'],
      'NO')
    wruntask -t Send_Email -l "T/EC Tasks" -h "stumpy" -E 
    -a "joe@company" -a "joe@company"
  2. The following example shows how to run a task based on an event sent from Tivoli Distributed Monitoring, which is monitoring an application instance of an MS SQL database. The filtering criteria for the rule is an event of class MSSQLDatabase_LogSpacePercentUsedDB with a severity of CRITICAL. The value for the collection attribute contains the resource type being monitored. The resource type and host name are instantiated in variables for use in the exec_task call.
    rule: plain_rule1_42: (
    description:'ADSM incremental backup task',
    
      event: _ev1 of_class within [
             'MSSQLDatabase_LogSpacePercentUsedDB']
        where [severity: _ev1_severity
               collection: _ev1_collection,
               hostname: _ev1_hostname
        ] ,
    
      reception_action: action0: (
        (exec_task(_ev1, 
                   'ADSMIncBackup', 
                   '-l MSSQLManagerTasks -h \'@%s:%s\'',
                   [_ev1_collection,_ev1_hostname], 
                    'YES'
                   )
        )
      )
    ).

    The exec_task call resolves to the following command when an event is received for an MSSQLDatabase collection on host master@holon@holon:

    wruntask -t ADSMIncBackup -l MSSQLManagerTasks \
    -h @MSSQLDatabase:master@holon@holon -E

See Also

exec_program, exec_program_local, exec_task_local

exec_task_local

Launches a task from a task library on the local event server.

Synopsis

exec_task_local(_name, _event, file_name, format_string, _arg_list, watch_status)

Description

This predicate launches a task asynchronously from a task library on the local server (local means the event server where the rule engine is installed). Tasks provided by the Tivoli Enterprise Console product are described in the IBM Tivoli Enterprise Console Command and Task Reference.

Note:
This predicate can only be run on a managed node.

When the program finishes, a TASK_COMPLETE event is generated if the watch_status argument is set to 'YES'. This event contains details about the task's execution. The TASK_COMPLETE event class is defined in the root.baroc file. A description of its attributes are as follows:

command
The name of the command to launch the task.
end_time
The time when the task finished.
execution_msg
Output from the task. This attribute contains a list of strings, each string representing a line of output from the program or script. This list is limited to 512 lines.
exit_status
The exit status set by the operating system for the task.
start_time
The time when the task started.
task_name
The name assigned to the task. It was assigned with the _name argument of the predicate.
task_number
An identifier for the executing task. These identifiers start at 1 and are incremented by 1 for each launch of a task.
task_status
The completion status for the task. These values are defined in the root.baroc file as RUNNING, SUCCESS, FAILURE, and UNKNOWN.
trigger_event_id
The identifier of the event that triggered the launch of the exec_task_local predicate.

Usually a pair of rules are created when using this predicate. The first rule launches the task. The second rule evaluates the results of the task when it is done and might take some action depending on the results.

Arguments

_arg_list
A list values (typically attributes of the event) to be supplied to the program in the form [1, 2, 3]. All of the attributes of the trigger event are also available to the task through environment variables; for example, the msg attribute value can be obtained from the $msg environment variable. See the IBM Tivoli Enterprise Console Command and Task Reference for additional information about environment variables available to running tasks and programs.

For every format specification in the format string, there must be a corresponding element in the argument list. The data types in the format string must be compatible with their corresponding values in the argument list. If there are no format specifications in the format string, the argument list must be an empty list, written as [ ]. The length of a formatted command line is limited to 256 characters.

_event
The pointer to the event that triggers running of the task. All attributes of this event are available to the task as environment variables. See the Tivoli Management Framework Reference Manual for additional information about environment variables available to running tasks and programs.
_format_string
The format string for formatting arguments to the command. %s (STRING), %d (INTEGER), and %ld (INT32) format specifications can be defined in the format string for use with the corresponding values in the argument list. If a format string is not specified, an empty _format_string argument must be specified in the form '' (two single quotation marks). The format string contains the name of the task library, the host name where the task will run, and any command line arguments to the task in the following form:
-l tasklibname -h hostname -a arg1 -a arg2...

The example exec_program shows the use of format strings.

Notes:
  1. The -l, -h, and -a arguments in the format string are the same as those used in the Tivoli Management Framework wruntask command. See the Tivoli Management Framework Reference Manual for details.
  2. The task name (-t TaskName) and pass environment variables (-E) wruntask command arguments are provided internally by the exec_task_local predicate.
_name
The name to assign the task. It is used to identify the task in a TASK_COMPLETE event.
file_name
The path and file name of the task to run. Relative paths can be specified from the $BINDIR/TME/TEC directory.
watch_status
Specifies whether a TASK_COMPLETE event is to be generated. Valid values are:
'NO'
Do not generate a TASK_COMPLETE event when the task finishes. This argument must be enclosed in single quotation marks.
'YES'
Generate a TASK_COMPLETE event when the task finishes. This argument must be enclosed in single quotation marks.

Examples

The following example shows:

  1. In the task_start rule, the send_dbadmin task is launched upon the reception of a TEC_DB event. The program is launched with the following characteristics:
    • The task is given the name of send_dbadmin.
    • There are two arguments for the task's command line.
    • A TASK_COMPLETE event is to be generated when the task finishes
  2. The task_result rule is triggered by the reception of a TASK_COMPLETE event with the task_name attribute set to send_dbadmin, which is the name of the task launched in the previous rule.
  3. The process_task_result action of the task_result rule does the following:
    1. Gets the value of the execution_msg attribute from the TASK_COMPLETE event and unifies that value with the _results variable. This attribute is a list of strings.
    2. _results is searched for an element with a value of OK.
    3. If an element with a value of OK is found in the list, the ok predicate is run. If it is not found, the not_ok predicate is run.
rule:  task_start: (

  event: _event of_class  'TEC_DB'
    where [  ],

  reception_action: start_it: (
    exec_task_local(
      'send_dbadmin,
      _event,
      'Send_Email',
      '-l "T/EC Tasks" -h "stumpy" -a "%s"
      -a "%s"',
      ['joe@company.com','joe@company.com'],
      'YES'
    )  
  )
).

rule: task_result: (

  event: _event of_class  'TASK_COMPLETE'
    where [task_name: _task_name equals 'send_dbadmin',
           % Test task name. Assign task_name value to
           % variable if passed.

           task_number: _task_num
           % Assign task_number attribute value to
           % variable.
    ],

  reception_action: process_task_result: (

    bo_get_slotval(_event,execution_msg,_results),
    % Get value of execution_msg attribute and assign to
    % variable. Attribute is a list type.

    member(_result_line,_results),
      (_result_line == 'OK'  ->
      % Test each element for OK value.

          ok
          % OK value found in list. Run ok predicate.

        ;     % Else.

          do_not_ok_thing
         % OK value not found in list. Run not_ok
         % predicate.)
  ) 
).

See Also

exec_program, exec_program_local, exec_task

first_causal_event

Searches the event cache for the root cause event related to an effect event.
Note:
Generally, the term causal event has been replaced by the term cause event, even though this command name has not been changed.

Synopsis

first_causal_event(_effect_event, _cause_event)

--OR--

first_causal_event(_effect_event, _cause_event, time_before, time_after)

Description

This predicate is used to search the event cache for the root cause event in an event sequence defined with the create_event_sequence predicate. The event must also meet the criteria defined with the create_event_sequence predicate. For example, if events A, B, C, and D are defined as an event sequence in that order, and event D is event under analysis, this predicate will return the most recent instance of event A if it exists and meets the defined criteria, otherwise return event B if it exists, otherwise return event C if it exists, otherwise it fails.

If the time_before and time_after arguments are not specified, the event cache search time window defaults to 2 years (1 year before and 1 year after). You should limit a time window to the smallest reasonable window whenever possible for better performance.

Arguments

_cause_event
A pointer to the root cause event found for the effect event. This argument must be free.
_effect_event
A pointer to the effect event whose cause event is being searched for. Typically the event under analysis.
time_after
The number of seconds after the effect event has been received. This argument is used to limit the event cache search to a time window.
time_before
The number of seconds before the effect event has been received. This argument is used to limit the event cache search to a time window.

Examples

The following example searches the event cache for a related cause event that has been previously received. If one is found, the effect event is acknowledged and linked to the cause event. This rule triggers on a superclass but it searches for a cause event. This design lets you create a single rule to process any number of events that are related.

rule: 'link_effect_to_cause':(

  event: _effect of_class 'EVENT',

  action: 'search_for_cause':(
    first_causal_event(_effect, _cause, 3600, 0),
    set_event_status(_effect, 'ACK'),
    link_effect_to_cause(_effect, _cause)
  )
).

See Also

create_event_sequence , first_effect_event, first_related_event

first_duplicate

Succeeds once for the first (most recent) duplicate event in the event cache that satisfies the specified additional attribute and time window conditions.

Synopsis

first_duplicate(_event, event: _duplicate where attribute_conditions)

--OR--

first_duplicate(_event, event:_duplicate where attribute_conditions, _referenceEvent -time_before -time_after)

Description

No class specification is required, since the duplicate events are always of the same class. For additional information about duplicate events, see What is a duplicate event?.

If the -time_before and -time_after arguments are not specified, the event cache search time window defaults to 2 years (1 year before and 1 year after). You should limit a time window to the smallest reasonable window whenever possible for better performance.

Arguments

_event
A pointer to the event currently under analysis.
_referenceEvent
A pointer to the reference event for the time window, typically the event under analysis.
event:_duplicate where attribute_conditions
Specifies an event filter for querying the event cache. _duplicate is instantiated with a pointer to each duplicate event found. See Event filters for additional information.
-time_after
The number of seconds after the reference event.
-time_before
The number of seconds before the reference event.

Examples

The following example rule shows how to count the number of duplicate NFS_NOT_RESPONDING events that are received and then drop them so they're not stored in the event database. This results in one event kept with its repeat_count attribute updated each time a duplicate is received.

Note that this example doesn't specify a time window argument, thus defaulting to a 2 year window (1 year before and 1 year after). You should limit a time window to the smallest reasonable window whenever possible for better performance.

rule: dup_nfs_not_resp:(

  event: _event of_class 'NFS_NOT_RESPONDING',

  action: dup_and_drop_event:(
    first_duplicate(_event,event: _dup_nfs_ev
                    where [status: outside ['CLOSED'] ]
    ),

    add_to_repeat_count (_dup_nfs_ev, 1),

    drop_received_event
  )
).

See Also

all_duplicates

first_effect_event

Searches the event cache for the logically earliest effect event related to a cause event.

Synopsis

first_effect_event(_cause_event, _effect_event)

--OR--

first_effect_event(_cause_event, _effect_event, time_before, time_after)

Description

This predicate is used to search the event cache for the effect event related to a cause event in an event sequence defined with the create_event_sequence predicate.

If the time_before and time_after arguments are not specified, the event cache search time window defaults to 2 years (1 year before and 1 year after). You should limit a time window to the smallest reasonable window whenever possible for better performance.

Arguments

_cause_event
A pointer to the cause event whose effect event is being searched for. Typically the event under analysis.
_effect_event
A pointer to the effect event found for the cause event. This argument must be free.
time_after
The number of seconds after the cause event has been received. This argument is used to limit the event cache search to a time window.
time_before
The number of seconds before the cause event has been received. This argument is used to limit the event cache search to a time window.

Examples

The following example searches the event cache for a related effect event that has been previously received. If one is found, the effect event is acknowledged and linked to its related cause event. This rule triggers on a superclass but it searches for a related effect event. This design lets you create a single rule to process any number of events that are related.

rule: 'link_cause_to_effect':(

  event: _cause of_class 'EVENT',

  action: 'search_for_effect':(
    first_effect_event(_cause, _effect, 3600, 0),
    set_event_status(_effect, 'ACK'),
    link_effect_to_cause(_effect, _cause)
  )
).

See Also

create_event_sequence , first_causal_event, first_related_event

first_instance

Succeeds once for the first (most recent) event in the event cache that satisfies the specified class, attribute, and time window conditions.

Synopsis

first_instance(event: _event of_class class where attribute_conditions)

--OR--

first_instance(event: _event of_class class where attribute_conditions, _referenceEvent -time_before -time_after)

Description

Succeeds once for the first event that satisfies the specified class, attribute, and time window conditions.

Arguments

_referenceEvent
A pointer to the reference event for the time window, typically the event under analysis.
event:_event of_class class where attribute_conditions
Specifies an event filter. See Event filters for additional information.
-time_after
The number of seconds after the reference event.
-time_before
The number of seconds before the reference event.

Examples

The following example shows a rule that:

  1. Queries the event cache for the first instance of a universal_host event with the following additional conditions:
    • The status is not CLOSED.
    • The probe_arg attribute for the first instance of the event in the cache has the same value as the server attribute for the event under analysis, which is an NFS_No_Response event.
    • The event's severity is CRITICAL.
    • The time window for searching is 20 minutes surrounding the event under analysis.
  2. If an event meeting these conditions is found in the event cache, its severity is upgraded to FATAL.
rule: escalate: (
description: 'escalate host down events when causing NFS
              problems',

  event: _event of_class 'NFS_No_Response'
    where [ server: _server],

  action: 'increase_sev': (
    first_instance(event: _down_ev of_class
                          'universal_host'
                     where [status: outside ['CLOSED'],
                            probe_arg: equals _server,
                            severity: equals 'CRITICAL'],
                    _event - 600 - 600 ),

    set_event_severity(_down_ev, 'FATAL') 
  )
).

See Also

any_clear_target

first_related_event

Searches the event cache for the logically earliest event related to a reference event.

Synopsis

first_related_event(_referenceEvent, _related_event, _relation)

--OR--

first_related_event(_referenceEvent, _related_event, _relation, time_before, time_after)

Description

This predicate is used to search the event cache for the logically earliest cause or effect event related to the reference event. Logically earliest means as defined from left-to-right in an event sequence, with the logically earliest event starting from the left. If the found event is a cause event, the _relation argument is instantiated with the value of c. If the found event is an effect event, the _relation argument is instantiated with a value of e. For example, if events A, B, C, and D are defined with the create_event_sequence predicate as an event sequence in that order and the first_related_event predicate is called with an instance of event C as the reference event, the first instance of event A would be returned with the _relation argument instantiated with a value of c if it exists, otherwise event B would be returned with _relation set to c if it exists, otherwise event D would be returned with _relation set to e if it exists, otherwise the predicate fails.

This predicate should be used whenever correlation is needed to find cause events in the event cache, and then find effect events if a cause event is not found. Because this predicate only performs one search, it is more efficient than using the first_causal_event predicate followed by the first_effect_event predicate sequence of calls.

If the time_before and time_after arguments are not specified, the event cache search time window defaults to 2 years (1 year before and 1 year after). You should limit a time window to the smallest reasonable window whenever possible for better performance.

Arguments

_referenceEvent
A pointer to the reference event whose logically earliest related event is being searched for.
_related_event
A pointer to the logically earliest related event found for the reference event. This argument must be free.
_relation
The relationship of the found event to the reference event. This argument must be free. Valid values are:
c
A cause event to the reference event.
e
An effect event to the reference event.
time_after
The number of seconds after the reference event has been received. This argument is used to limit the event cache search to a time window.
time_before
The number of seconds before the reference event has been received. This argument is used to limit the event cache search to a time window.

Examples

The following example searches the event cache for the logically earliest event related to the event under analysis. If one is found, the found event is acknowledged and linked to the reference event, either as a cause event or effect event, depending upon the returned value of the relation argument. This rule triggers on a superclass but it searches for a related event. This design lets you create a single rule to process any number of events that are related.

rule: 'link_effect_to_cause':(

  event: _ev of_class 'EVENT',

  action: 'search_for_cause_or_effect':(
    first_related_event(_ev, _related,_relation, 3600,0),
    (
      _relation == 'c',
      set_event_status(_ev, 'ACK'),
      link_effect_to_cause(_ev, _related)
    ;
      set_event_status(_related, 'ACK'),
      link_effect_to_cause(_related, _ev)
    )
  )
).

See Also

create_event_sequence , first_causal_event, first_effect_event

forward_event

Forwards an event to an event server.

Synopsis

forward_event(_event)

Description

This predicate forwards an event to an event server.

The predicate looks for the event server's location in the tec_forward.conf file (located in the rule_base_dir/TEC_RULES directory). You must edit the tec_forward.conf file and change the value for the ServerLocation option to the host name of the system for the forwarded event.

Note:
Because the forward_event predicate uses a non-Tivoli connection, you must specify the location of the server as an IP address or TCP/IP host name, regardless of whether there is a connection between the Tivoli regions.

The default setting in the tec_forward.conf file for the TestMode option is yes. This means that events are forwarded to a file. In order to actually forward an event to an event server, you must delete or comment out the TestMode option in the tec_forward.conf file.

Arguments

_event
A pointer to the event to forward, typically the event under analysis.

Examples

The following example forwards events with a severity of CRITICAL or FATAL to the event server specified in the tec_forward.conf file:

rule: escalate: (

  event: _evt of_class within [ 'EVENT' ] 
    where
      [severity: within ['CRITICAL', 'FATAL'],

  reception_action: action0:(
    forward_event(_evt)
  )
).

See Also

None.

generate_event

Generates an internal event.

Synopsis

generate_event(event_class, list_of_event_attributes)

Description

This predicate generates an event internally; that is, from within the event server instead of externally from a source such as an event adapter.

Arguments

event_class
The event class for the generated event.
list_of_event_attributes

The attributes for the generated event. The attributes must be specified in a list using the following format:

[attribute1=value1, attribute2=value2,...]

Examples

The following example generates an event of class TradingDBDown with 4 attributes:

action:(
  generate_event('TradingDBDown',
                 [source='SNMP',
                  origin=_origin,
                  hostname=_host,
                  msg='Trading DB host is down']
                )
)

See Also

None.

get_attributes

Retrieves event attribute values.

Synopsis

get_attributes(_event, [ attribute_name=_attribute_value, ...] )

Description

This predicate retrieves the values of event attributes and instantiates variables with those values. The second argument is in list format.

Arguments

_attribute_value
The variable to instantiate with the attribute value.
_event
The event from which to get the attribute values. Typically the event under analysis.
attribute_name
The name of the attribute whose value to retrieve.

Examples

The following example retrieves the hostname, severity, and status attribute values from the event under analysis and instantiates them in the _hostname, _severity and _status variables, respectively:

get_attributes(_event,[hostname=_hostname,
                       severity=_severity,
                       status=_status
                      ] 
)

See Also

None.

get_config_param

Gets a rule engine configuration setting.

Synopsis

get_config_param(_name, _variable, default)

Description

This predicate gets a rule engine configuration value defined in the $BINDIR/TME/TEC/.tec_config file and unifies it with a variable.

If the _name argument does not exist in the file, the default argument is unified with the _variable argument.

Arguments

_name
The name of the configuration setting.
_variable
The variable to unify with the value of the configuration setting.
default
The value to unify with _variable if _name does not exist as a configuration setting in the file.

Examples

The following example sets the _tec_rule_host variable to chair. If the tec_rule_host setting did not exist in the file, the variable would have been set to a value of not set. Some .tec_config file entries are shown first.

#.tec_config settings

#tec_rule_cache_size=10000
#tec_rule_cache_full_history=86400
#tec_rule_cache_non_closed_history=155520
#tec_rule_cache_clean_freq=3600
tec_rule_trace=YES
tec_rule_trace_file=/tmp/rules.trace
tec_rule_host=chair
tec_server_handle=5
get_config_param(tec_rule_host,_tec_rule_host,'not set')

See Also

None.

get_global_grp

Gets the value of all global variables in a group.

Synopsis

get_global_grp(_group, _key,_value)

Description

This predicate gets the value of all global variables in a group from the knowledge base. The predicate loops through the variables in the group and instantiates _value for each variable found. _value and _key must be free.

Arguments

_group
The group key for the variables.
_key
The key for the variables. Must be free.
_value
The value of the key. Must be free.

Examples

The following example gets all of the global variables for the Maintenance group.

get_global_grp('Maintenance', _key, _value),

See Also

get_globals, get_global_var

get_global_var

Gets a value of a global variable.

Synopsis

get_global_var(_group, _key,_value,_default)

Description

This predicate gets the value of one global variable from the knowledge base and unifies it with _value. If the variable has no value, it is set to _default and _default is unified with _value. _value must be free.

Arguments

_default
The value for the variable if it currently has no value.
_group
The group key for the variable.
_key
The key for the variable.
_value
The value of the key. Must be free.

Examples

The following example rule:

  1. Gets the value for a global variable with a group key of Maintenance and a key value equal to the value of the origin attribute of the event under analysis. If there is no value for that key, it is initialized to a value of off.
  2. A check is performed on the value of the global variable to see if the host is in maintenance mode.
  3. If the check is true, the event under analysis is dropped and the rule set is exited.
rule:
check_maint_mode:
(
     event: _event of_class _event_class
          where [
               origin: _origin
          ],
     reception_action:
          (
          get_global_var('Maintenance', _origin, _maint_mode, 'off'),
          _maint_mode == 'on',
          drop_received_event,
          commit_rule
          )
).

See Also

get_globals, get_global_grp

get_globals

Gets all global variables.

Synopsis

get_globals(_group, _key,_value)

Description

This predicate returns the group key, key, and value for each global variable. The arguments must be free. The predicate loops through the global variables and instantiates the three arguments for each global variable found.

Arguments

_group
The group key.
_key
The key.
_value
The value of the key.

Examples

The following example shows predicate usage:

get_globals(_group,_key,_value)

See Also

get_global_grp, get_global_var

get_gm_time

Gets the current time represented in Greenwich mean time (GMT).

Synopsis

get_gm_time(_time_gm_struct)

Description

This predicate gets the current time represented in GMT. _time_gm_struct must be free.

Arguments

_time_gm_struct
Represents a time structure in GMT. Do not confuse it with the data returned by the get_time predicate, in which the value for the _time_epoch argument is a number representing how many seconds have passed since an epoch.

Examples

The following example shows how to get the structure for the current time in GMT, convert the time to a string, and update the time_string attribute of the event with the string:

get_gm_time(_time_gm_struct),
convert_ascii_time(_time_gm_struct, _time_string),
bo_set_slotval(_event, time_string, _time_string)

See Also

bo_set_slotval, convert_ascii_time, get_time, resolve_time

get_local_time

Gets the current local system time.

Synopsis

get_local_time(_time_local_struct)

Description

This predicate gets the current local system time. _time_local_struct must be free.

Arguments

_time_local_struct
Represents a time structure in local system time. Do not confuse it with the data returned by the get_time predicate, in which the value for the _time_epoch argument is a number representing how many seconds have passed since an epoch.

Examples

The following example shows how to get the structure for the current local system time, convert the time to a string, and update the time_string attribute of the event with the string:

get_local_time(_time_local_struct),
convert_ascii_time(_time_local_struct, _time_string),
bo_set_slotval(_event, time_string, _time_string)

See Also

bo_set_slotval, convert_ascii_time, get_time, resolve_time

get_time

Gets the current time represented by an integer since the epoch, which is 00:00:00 Greenwich mean time (GMT) 01 Jan 1970 for most systems.

Synopsis

get_time(_time_epoch)

Description

This predicate gets the current time represented by an integer number of seconds since the epoch. _time_epoch must be free.

Arguments

_time_epoch
Represents an epoch time number. Do not confuse it with the data returned by the get_local_time predicate, in which the value for the _time_local_struct argument is a time structure.

Examples

The following example shows how to get the epoch time number and then update the time_epoch attribute of the event with the number.

get_time(_time_epoch),
bo_set_slotval(_event, time_epoch, _time_epoch)

See Also

bo_set_slotval

global_exists

Checks the existence of a global variable.

Synopsis

global_exists(_group, _key)

Description

This predicate checks that the global variable in group key _group at key _key exists. If the variable exists, the predicate succeeds.

Arguments

_group
The group key for the variable to check.
_key
The key for the variable to check.

Examples

The following example checks for the global variable whose key is the value of the origin attribute of the event under analysis and belongs to the Maintenance group:

global_exists('Maintenance',_origin)

See Also

None.

increment_slot

Adds a number to the value of the specified integer attribute.

Synopsis

increment_slot(_event, _attribute_name, _by_value, _trigger)

Description

This predicate adds a number to the value of the specified integer attribute.

Note:
Generally, the term slot has been replaced by the term attribute, even though this command name has not been changed.

Arguments

_attribute_name
The attribute to change.
_by_value
The amount to add.
_event
A pointer to the event to change.
_trigger
Specifies whether change rules should be evaluated as a result of this attribute change. Valid values are: 'YES', yes, 'NO', or no.

Examples

The following example shows predicate usage:

increment_slot(_event,host_down,1,no)

See Also

decrement_slot

init_count

Creates and initializes a counter.

Synopsis

init_count(_key1, _key2, _value)

Description

This predicate creates a counter identified by the values of _key1 and _key2. It also initializes the counter to the value of _value. Typically, the initial value is set to 0.

This predicate is used in conjunction with the check_and_increment_count predicate, which is used to increment a count and compare it to a threshold value.

Notes:
  1. If a counter is not created and initialized with the init_count predicate, it is created and initialized to 0 the first time the check_and_increment_count predicate is called to check the counter.
  2. Once initialized, a counter continues counting until explicitly reinitialized with a new starting value.
  3. You must reinitialize a counter that has reached its threshold if it is still needed for counting.

Counters are used to keep track of any arbitrary numeric value. The values of _key1 and _key2 can be set to easily identify the information being recorded. For example:

If the event server stops, all counters are discarded.

Arguments

_key1
The primary key name for the counter. Must be instantiated.
_key2
The secondary key name for the counter. Must be instantiated.
_value
The value to initialize the counter. Must be instantiated.

Examples

The following example counts the number of paper jams on a set of printers, based on receiving an event class of Printer_Jam. Printer counters are identified using a failure,component scheme. Printer_Jam events identify each printer in the hostname attribute.

Each counter is created, initialized to 0, and incremented to 1 the first time the check_and_increment_count predicate is called for a particular printer. Each subsequent call for that printer increments the count and then compares the count to the threshold value.

An administrator is notified when the number of paper jams on a printer reaches 5, and then the counter for that printer is reset to 0 using the init_count predicate. The administrator notification and reset of a counter is done in an ELSE clause of a Prolog statement because the check_and_increment_count predicate behavior is to fail when the count matches the threshold value.

rule: printer_jam: (

  event : _ev of_class 'Printer_Jam'
    where [hostname: _hn within ['flr4rm23',
                                 'flr3rm12',
                                 'flr1rm11',
                                 'flr6rm9'
                                ],

  action: check_count: (
    (check_and_increment_count(printer_jam,_hn,5,_count)
    
    ;
    % ELSE clause follows

    exec_program(_ev,'scripts/notify.sh',
                 'Printer failure on %s', [_hn], no),

    init_count(paper_jam,_hn,0)
    )
  )
).

See Also

check_and_increment_count

init_event_activity

Defines the reporting criteria for generating an event activity report.

Synopsis

init_event_activity(_file, _event_ exclusions, _attribute_criteria, _threshold)

Description

This predicate defines the file for the report and defines the criteria for generating the report. An event activity report contains summary counts of the events in the event cache. You can configure the report to exclude particular events, filter on event attributes, and exclude counts that fall below a threshold value.

This predicate should be run in a rule triggered by a TEC_Start event at event server start-up time. This loads the predicate once, instead of every time it is needed.

Arguments

_attribute_criteria
The attributes whose summary counts to include in the report. The argument must be in list format; for example, [source, hostname, severity].

A list element can be a single attribute or a nested list of multiple attributes; for example, [hostname, severity] can be one element. In the example of the [hostname, severity] nested list, a count of each severity is given for each host.

The class keyword can be used in a nested list to count by event class name. For example, the [class, hostname] nested list provides a count of each host for each event class.
_event_exclusions
The class names of the events whose information to exclude in the report. This argument must be in list format; for example, ['TEC_Heartbeat', 'TEC_Maintenance'].
_file
The path and file name where the report is written.
_threshold
Any specification in the _attribute_criteria argument whose count is less than this value is not be shown in the report.

Examples

  1. The following example shows how to use the predicate:
    _rep_freq is 20,
    init_event_activity(
      '/tmp/event_activity',  
      % Report file
    
      ['TEC_Heartbeat',     % Do not report these events
       'TEC_Maintenance'
      ],
    
      [source,              % Single attribute reporting
       hostname, 
       severity,
       status,
    
       [hostname,severity], % Multiple attribute reporting
    
       [class,hostname]     % Class reporting
      ],
      5                     % Do not report counts less
                            %than this 
    ),
  2. The initial timer for an event activity report must be started by a TEC_Tick event. The following example shows how to do this:
    rule: configure_event_activity: (
    
      event: _event of_class 'TEC_Tick'
        where [msg: _msg equals 'Event Activity Report',
               duration: _reporting_frequency],
    
      reception_action: start_timer: (
        set_timer(_event,_reporting_frequency,_msg),
        commit_rule
      )
    ).
  3. The following example shows a fragment of an event activity report:
                    Event Activity For Server tkennedy
    
    From: Thu Mar 02 14:14:02 2000.
    To  : Thu Mar 02 14:14:18 2000.
    
    Reporting Frequency: 0 Minutes.
    
    Total Events:        3332 
    
    Reporting Threshold: 5  
    
    =============================================================
                            Event Class Summary
    =============================================================
    
    Count                Class Name
    -------------------------------------------------------------
    849                TEC_Tick
    848                TEC_DB
    822                TEC_Notice
    812                TEC_Error
    
    
    =============================================================
                            Slot  Summary
    =============================================================
    
    Count                Slot Criteria
    -------------------------------------------------------------
    3332                status=OPEN
    590                severity=MINOR
    574                severity=WARNING
    564                severity=CRITICAL
    550                severity=UNKNOWN
    544                severity=HARMLESS
    510                severity=FATAL
    12                hostname=midnight.austin.lab.tivoli.com
    12                source=69.1.3.30
    11                hostname=dhcp12-235.austin.lab.tivoli.com
    11                source=69.1.12.235
    11                hostname=stingray.austin.lab.tivoli.com
    11                source=69.1.5.82
    10                hostname=austin.lab.tivoli.com
    10                source=69.1.1.6

See Also

print_event_activity

ip_node_unreachable

Determines if the event was sent from an unreachable subnet.

Synopsis

ip_node_unreachable(_ipaddress, _event)

Description

This predicate tests to see if the given IP address is contained in the cache the event server maintains of unreachable IP addresses. If _ipaddress matches the subnet address and subnet mask of any of the subnets contained in the cache, the _event argument is set to the event handle for the corresponding TEC_ITS_SUBNET_STATUS event.

This event can then be used to correlate the current event to the corresponding TEC_ITS_SUBNET event by using the link_effect_to_cause predicate. To check the success of the correlation, test that the the _event argument is unified with an existing event, by using ground(_event). If it succeeds, there is a valid correlation.

This predicate requires that the NetView component be installed and that the netview.rls rule set is active.

Arguments

_ipaddress
The unreachable IP address.
_event
If the predicate is successful, this argument contains the event handle of the cached TEC_ITS_SUBNET_STATUS event that matches the IP address. If no event is found, this argument is unchanged.

is_clearing_event

Tests whether an event has been defined as a clearing event with the create_clearing_event or create_event_sequence predicate.

Synopsis

is_clearing_event(_event)

Description

This predicate is used to test whether a rule or rule action should be run. If the event has been defined as a clearing event with the create_clearing_event or create_event_sequence predicate, and meets all of the appropriate conditions of the definition, the is_clearing_event predicate succeeds.

Arguments

_event
A pointer to the event to test if it is a clearing event.

Examples

The following example rule fragment tests whether the event under analysis is a clearing event. If the test passes, processing would continue with the next statement in the action. This rule triggers on the base event, so every incoming leaf event is tested.

rule: 'process_clearing_events':(

  event: _ev of_class 'EVENT',

  reception_action: 'check_for_clear':(
    is_clearing_event(_ev),
    ...

See Also

create_clearing_event , create_event_sequence

link_effect_to_cause

Links an effect event to a cause event.

Synopsis

link_effect_to_cause(_effect_event, _cause_event)

Description

This predicate updates the cause_date_reception and cause_event_handle attributes of the effect event so that these attributes contain a reference to the cause event. The value of the date_reception attribute of the cause event is placed in cause_date_reception attribute and the value of event_handle attribute of the cause event is placed in the cause_event_handle attribute.

Arguments

_cause_event
The cause event.
_effect_event
The effect event.

Examples

The following example links a universal_oserv event to a universal_host event if they are related, determined by their probe_arg attribute values. If they are related, the status attribute for the universal_oserv event is set to ACK.

rule: link_oserv_to_host: (

  event: _event of_class 'universal_oserv'
    where [probe_arg: _probe_arg,
           severity: equals 'WARNING'
          ],

  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) 
  )
).

See Also

unlink_from_cause

load_globals

Loads global variables from a file into the knowledge base.

Synopsis

load_globals(_file)

Description

This predicate loads all the global variables from a file into the knowledge base.

Arguments

_file
The path and file name that contains the variable definitions to load.

Examples

The following example shows predicate usage:

load_globals('/tmp/globalvars.txt')

See Also

save_globals

log_error

Generates error messages to assist in rule development.

Synopsis

log_error(format_string, variable_list, severity)

Description

This predicate should be run from within a predicate you've created to help you debug rules. The more recent rule language predicates provided by IBM have this predicate embedded within them to help you debug problems with rules.

This predicate provides error messages the following ways:

Before calling the log_error predicate, do the following setup tasks:

Arguments

_format
The format specification for the output. The following format specifications are valid:
%c
Character.
%d
Integer printed in decimal notation.
%e
Real printed in exponential notation.
%f
Real printed in decimal notation.
%g
Real printed in its shortest form (decimal or exponential notation).
%o
Integer printed in octal notation, without sign and leading zero.
%s
String.
%u
Integer printed in unsigned decimal notation.
%x
Integer printed in hexadecimal notation, without sign and leading 0x.

You can supply more detailed conversion specifications between the % sign and the conversion character, as follows:

-
Left adjustment.
0
Zero padding to the left.
n
In cases of an integer or a string, n is the minimum length of the field.
n.m
In cases of a real, n is the minimum length of the field and m indicates the number of digits after the decimal point.
severity
Specifies the severity to assign the generated TEC_Error event.
variable_list
A list of variables whose values will appear in the message. There must be a matching format specification for each variable.

Examples

The following example shows a user-defined predicate named my_predicate that receives an argument (_data) that is actually passed in to be the argument of a user-defined predicate named check_data. The check_data predicate is the predicate to be debugged. The logic is as follows:

  1. Define a source location named my_predicate for a point of reference from an error message. This is done with the set_log_error_source predicate.
  2. Enable rule tracing of the check_data predicate with the trace_it predicate. To actually write the rule trace information to a file, the set_detailed_debugging predicate had to be run previously. The trace_it predicate just enables tracing.
  3. If the check_data predicate fails, the log_error predicate is run and the Bad Data message along with the my_predicate source identifier are written to the error file. The tell_err predicate had to be run previously to define the location and name of the error file.

    Additionally when the check_data predicate fails, a TEC_Error event is sent to the event server with a severity of CRITICAL, the Bad Data message, and the my_predicate source identifier. The message and the source identifier are assigned to the msg attribute of the event.

my_predicate(_data):-
  set_log_error_source(my_predicate),

  (
    trace_it(check_data), 
    process_data(_data)

  ;
    log_error('Bad Data %s',[_data],'CRITICAL')
  )

See Also

set_log_error_source

place_change_request

Requests a change to an attribute value.

Synopsis

place_change_request(_event, _attributename, _newattributevalue)

Description

Change rules are triggered in response to the requested change. If there are no change rules in the rule base, the bo_set_slotval predicate would be a more efficient choice to change an attribute value, because processing resources are not used to check the rule base for change rules.

Arguments

_attributename
The attribute to change.
_event
A pointer to the event containing the attribute to change.
_newattributevalue
The value to assign the updated attribute.

Examples

The following example requests to change the hostname attribute to a value of myhost:

place_change_request(_event, hostname, myhost)

See Also

bo_set_slotval, re_mark_as_modified

print_cache

Writes the event cache to a file.

Synopsis

print_cache(file_name)

--OR--

print_cache(file_name, event:_event of_class class where attribute_conditions)

Description

This predicate writes the event cache to a file. Two forms are provided:

Arguments

event:_event of_class class where attribute_conditions
Specifies an event filter for identifying particular events to write to the file. Do not use the same for the _event and class variables as those used in the event filter for the rule.
file_name
The path and file name to which the event cache is written.

Examples

  1. The following example writes all of the events in the event cache to the /tmp/cache file.
    print_cache('/tmp/cache/')
  2. The following example writes all events of class TEC_Start in the event cache to the /tmp/cache file.
    rule: print_cache: (
          event: _event of_class _class,
          reception_action: (
    print_cache('/tmp/cache', event: _cached_event of_class 'TEC_Start')
           )
    ).
  3. The following example writes all events whose status attribute has a value of CLOSED in the event cache to the /tmp/cache file.
    rule: print_cache: (
          event: _event of_class _class,
          reception_action: (
                   print_cache('/tmp/cache',
                   event: _cached_event of_class _cached_class where 
                   [status: equals 'CLOSED'])
          )
    ).

See Also

print_class_tree, print_event_activity

print_class_tree

Formats and writes an event class hierarchy tree from the active rule base to a file.

Synopsis

print_class_tree(_file, _class)

Description

This predicate formats and writes an event class hierarchy tree from the active rule base to a file, starting from a specified class as the root and continuing down to the leaf classes. It also prints the maximum depth and the total width of the tree, which is a representation of the general size of the tree.

Arguments

_class
The name of the event class to start from in the class hierarchy.
_file
The path and file name to which the event class tree is written.

Examples

The following example formats and writes the entire event class tree of the active rule base (because the starting point is the base event class EVENT) to the /tmp/class_tree file.

print_class_tree('/tmp/class_tree', 'EVENT')

See Also

print_cache, print_event_activity

print_event_activity

Writes the event activity report defined with the init_event_activity predicate.

Synopsis

print_event_activity

Description

This predicate writes the event activity report using the criteria set in the init_event_activity predicate. It is usually run from within a timer rule.

The frequency of when to write the report is controlled with the _duration argument of the set_timer predicate.

Arguments

None.

Examples

  1. The initial timer for an event activity report must be started by a TEC_Tick event so it can run indefinitely. The following example shows how to do this:
    rule: configure_event_activity: (
    
      event: _event of_class 'TEC_Tick'
        where [msg: _msg equals 'Event Activity Report',
               duration: _rep_freq],
    
      reception_action: start_timer: (
        set_timer(_event,_rep_freq,_msg),
        commit_rule
      )
    ).
  2. The following example shows a use of the print_activity_report predicate. An example report is shown in init_event_activity.
    timer_rule: print_and_reset_event_activity: (
    
      event: _event of_class _class
        where [ ],
    
      timer_info: equals 'Event Activity Report',
      timer_duration: _rep_freq,
    
      action: print_and_reset_event_activity: ( 
        print_event_activity,
        reset_event_activity,     
        set_timer(_event,_rep_freq,
                  'Event Activity Report')
      )
    ). 

See Also

init_event_activity

re_after_match

Searches for a match in a string using a named regular expression and returns the substring located after the match as a result.

Synopsis

re_after_match(_name, _string, _result)

Description

This predicate searches for a match in _string using a named regular expression defined with the re_create predicate. The predicate succeeds if a match is found. The substring after the match is returned in _result.

Refer to Perl documentation for information about regular expression syntax and usage.

Arguments

_name
The name of a regular expression defined with the re_create predicate.
_result
The substring located after the match.
_string
The string to search for a match.

Examples

The following example shows how to use the predicate:

re_create(test,'a.*i')
% Create regular expression test.

re_after_match(test,'chair',_result)
% Search 'chair' using regular expression test. 
% Return the substring after the match in _result.
% Succeeds, 'r' returned in _result.

See Also

re_before_match, re_create

re_before_match

Searches for a match in a string using a named regular expression and returns the substring located before the match as a result.

Synopsis

re_before_match(_name, _string, _result)

Description

This predicate searches for a match in _string using a named regular expression defined with the re_create predicate. The predicate succeeds if a match is found. The substring before the match is returned in _result.

Refer to Perl documentation for information about regular expression syntax and usage.

Arguments

_name
The name of a regular expression defined with the re_create predicate.
_result
The substring located before the match.
_string
The string to search for a match.

Examples

The following example shows how to use the predicate:

re_create(test,'a.*r')
% Create regular expression test.

re_before_match(test,'chair',_result)
% Search 'chair' using regular expression test. 
% Return the substring before the match in _result.
% Succeeds, 'ch' returned in _result.

See Also

re_after_match, re_create

re_create

Defines a regular expression for use with other regular expression predicates.

Synopsis

re_create(_name, _pattern)

Description

This predicate defines a named regular expression that can be referenced by other regular expression predicates. The predicate fails if the regular expression is not valid. It should be run in a rule triggered by a TEC_Start event at event server start-up time. This loads the predicate once, instead of every time it is needed.

Refer to Perl documentation for information about regular expression syntax and usage.

Arguments

_name
The name that uniquely identifies the regular expression.
_pattern
The regular expression.

Examples

The following example shows how to define a regular expression and reference it from another regular expression predicate:

re_create(test,'h.*i')
% Create regular expression test.

re_search_string(test,'chair')
% Compare 'chair' to regular expression test. 
% Succeeds, matches 'hai'.

See Also

None.

re_mark_as_modified

Updates information for an event in the event database.

Synopsis

re_mark_as_modified(_event, _)

Description

This predicate is typically run after using the bo_set_slotval predicate to update event consoles and event database with the latest attribute values for an event.

Arguments

_
Uninstantiated variable used internally by Prolog. Also referred to as the anonymous variable.
_event
A pointer to the event to update. This should be the same event pointed to by the _event argument in bo_set_slotval.

Examples

The following example shows how to update the data for the event pointed to by _oldevent:

re_mark_as_modified(_oldevent, _)

See Also

bo_set_slotval, place_change_request

re_match

Searches for a match in a string using a named regular expression and returns a result.

Synopsis

re_match(_name, _string, _index, _result)

Description

This predicate searches for a match in _string using a named regular expression defined with the re_create predicate. The predicate succeeds if a match is found. The matched substring is returned in _result. The _index argument is used to specify which part of the matched substring to return.

Refer to Perl documentation for information about regular expression syntax and usage.

Arguments

_index
The part of the match to return in _result. A value of 0 returns the entire matching substring, a value of 1 indexes into the matched substring one position and returns the result, a value of 2 indexes into the substring two positions and returns the result, and so forth.
_name
The name of a regular expression defined with the re_create predicate.
_result
The matched substring, subject to the _index specification.
_string
The string to search for a match.

Examples

The following example shows how to use the predicate:

re_create(test,'a.*r')
% Create regular expression test.

re_match(test,'chair',0,_result)
% Search 'chair' using regular expression test. 
% Return the entire result in _result.
% Succeeds, 'air' returned in _result.

See Also

re_create

re_search_string

Searches for a match in a string using a named regular expression.

Synopsis

re_search_string(_name, _string)

Description

This predicate searches for a match in _string using a named regular expression defined with the re_create predicate. The predicate succeeds if a match is found.

Refer to Perl documentation for information about regular expression syntax and usage.

Arguments

_name
The name of a regular expression defined with the re_create predicate.
_string
The string to search for a match.

Examples

The following example shows how to use the predicate:

re_create(test,'h.*i')
% Create regular expression test.

re_search_string(test,'chair')
% Search 'chair' using regular expression test. 
% Succeeds, matches 'hai'.

See Also

re_create

re_send_event_conf

Sends an event to a remote event server.

Synopsis

re_send_event_conf(_conf_file, _event)

Description

This predicate sends an event to a remote event server defined in a configuration file. The configuration file must be located in the TEC_RULES subdirectory of the loaded rule base. The predicate references the configuration file by file name only, leaving off the .conf file name extension; for example, with a configuration file named host.conf, specify the value of host for the _conf_file argument. Each time a new configuration file is referenced by the predicate, its name is added to an internal configuration file table and its file handle is kept open. A maximum of 50 concurrent different configuration files are supported.

This predicate supports both connection and connectionless modes of operations. If events are to be forwarded to a remote event server frequently, ensure that the configuration file specifies connection_oriented for the ConnectionMode option. This communication prevents the event server from having to establish a communications channel each time an event is forwarded.

In addition, to ensure that the events intended for a remote event server are separated from events intended for another remote event server, the configuration file must specify the location and name of the cache file for events destined to a remote event server; for example, BufEvtPath=/etc/tivoli/orange.cache.

The following figure shows an example of a configuration file for use with the re_send_event_conf predicate. Configuration file options are described in the IBM Tivoli Enterprise Console Adapters Guide.

ServerLocation=orange.tivoli.com
TestMode=no
BufEvtPath=/etc/Tivoli/orange.cache
# ConnectionMode=connection_oriented

Note:
If the configuration file is used in a rule base target, it must be distributed with the rule base target. This can be done by using the -imptgtdata option of the wrb command. See the IBM Tivoli Enterprise Console Command and Task Reference IBM Tivoli Enterprise Console Command and Task Reference for complete details about the wrb command.

Arguments

_conf_file
The configuration file that defines remote event server information.
_event
The event to be sent.

Examples

The following example sends the event under analysis to the remote event server specified in the configuration file host.conf:

re_send_event_conf('host', _event)

See Also

forward_event

re_split_event_id

Parses an element of the server_path event attribute.

Synopsis

re_split_event_id(_path_element, _host, _server_handle, _date_reception, _event_handle)

Description

This predicate receives a list element from the server_path attribute as input, parses the element, and unifies (assigns) the parsed values with variables provided as arguments to the predicate. The server_path attribute is a list of elements that provides information about each event server that an event has passed through. Each element contains the information about one event server. The information is for each element is in the format of an event ID, which is described in the section, Event cache. See the IBM Tivoli Enterprise Console Adapters Guide for additional information about the server_path attribute.

Arguments

_date_reception
The reception date of the event at the server is unified with this variable. This value was obtained from the date_reception attribute when the event was received at the server.
_event_handle
The handle of the event at the server is unified with this variable. This value was obtained from the event_handle attribute when the event was received at the server.
_host
The hostname of the server is unified with this variable. The value was obtained from the tec_rule_host configuration setting in the $BINDIR/TME/TEC/.tec_config file of the host where the server resides.
_path_element
The list element of the server_path attribute to parse. Each element represents a server that the event has passed through.
_server_handle
The handle of the server is unified with this variable. This value was obtained from the tec_server_handle configuration setting in the $BINDIR/TME/TEC/.tec_config file of the host where the server resides.

Examples

The following example iterates through each element in the server_path attribute and parses it:

bo_get_slotval(_event,server_path,_server_path),
% Get the list for the server_path attribute.

member(_item,_server_path),
% Get an element of the list.
% Because _item is free, the list will be traversed
% and each element will be returned in succession.

  re_split_event_id(_item,_host,_server_handle,
                    _date_reception,_event_handle)
  % Parse each element into variables.

See Also

bo_get_slotval, member

re_substitute

Searches for a match in a string using a named regular expression, replaces the match, and returns the new string as a result.

Synopsis

re_substitute(_name, _string, _substitute, _result)

Description

This predicate searches for a match in _string using a named regular expression defined with the re_create predicate. The predicate succeeds if a match is found. The value in _substitute replaces the match and the new string is returned in _result.

Refer to Perl documentation for information about regular expression syntax and usage.

Arguments

_name
The name of a regular expression defined with the re_create predicate.
_result
The new string after substitution has been done.
_string
The string to search for a match.
_substitute
The value to replace the match with.

Examples

The following example shows how to use the predicate:

re_create(test,'a.*w')
% Create regular expression test.

re_substitute(test,'hawk','oo',_result)
% Search 'hawk' using regular expression test. 
% Return the new string in _result.
% Succeeds, 'hook' returned in _result.

See Also

re_create, re_substitute_global

re_substitute_global

Searches for all matches in a string using a named regular expression, replaces them, and returns the new string as a result.

Synopsis

re_substitute_global(_name, _string, _substitute, _result)

Description

This predicate searches for all matches in _string using a named regular expression defined with the re_create predicate. The predicate succeeds if at least one match is found. The value in _substitute replaces all occurrences of a match and the new string is returned in _result.

Refer to Perl documentation for information about regular expression syntax and usage.

Arguments

_name
The name of a regular expression defined with the re_create predicate.
_result
The new string after substitution has been done.
_string
The string to search for a match.
_substitute
The value to replace matches with.

Examples

The following example shows how to use the predicate:

re_create(test,'a.*w')
% Create regular expression test.

re_substitute_global(test,'hawkhawkhawk','oo',_result)
% Search 'hawk' using regular expression test. 
% Return the new string in _result.
% Succeeds, 'hookhookhook' returned in _result.

See Also

re_create, re_substitute

redo_analysis

Requests a reanalysis for an event.

Synopsis

redo_analysis(_event)

Description

When correlating events, it might be necessary to re-evaluate the analysis of a previously received event. This predicate requests that the rule engine redo the analysis of regular rules for the specified event.

Note:
It is possible to make the rule engine loop by using the redo_analysis predicate. For example if in the analysis of event A you ask to redo analysis of event B and vice-versa, the rule engine might enter an infinite loop.

Arguments

_event
Specifies the event for which the analysis is to be redone.

Examples

The following example places a redo request on previously received INSTALLATION_FAILED events that might have been caused by the disk being full:

rule: disk_full_check_install_failed: (
  description: 'look for installationfailed events for this
                host',

  event: _event of_class 'DISK_FULL' 
    where [status: equals 'OPEN',
           hostname: _hostname ],

  action: (
    all_instances(event: _install_ev
                  of_class 'INSTALLATION_FAILED'

                    where [target_host: equals _hostname],
                           _event -600 -600 ),
    redo_analysis(_install_ev)
  )
).

See Also

None.

remove_bslashes

Converts back slashes to forward slashes in directory paths. In order to prevent backslashes from being interpreted as escape sequences, backslashes used as path separators must be specified as double backslashes.

Synopsis

remove_bslashes(_path1, _path2)

Description

This predicate converts the back slashes in the _path1 argument to forward slashes and unifies the new path with the _path2 argument.

Arguments

_path1
The directory path to convert.
_path2
The converted directory path.

Examples

The following example converts back slashes in a directory path to forward slashes:

% Assign value.
_path="\\tivoli\\data\\repository',

% Convert back slashes.
% _new_path is unified with /tivoli/data/repository.
remove_bslashes(_path,_new_path)

See Also

None.

reset_event_activity

Resets the counts for all event reporting criteria to 0.

Synopsis

reset_event_activity

Description

This predicate resets the counts for all event reporting criteria to 0. It is usually run from within a timer rule following the print_event_activity predicate.

Arguments

None.

Examples

The following example shows a use of the predicate:

timer_rule: reset_event_activity: (

  event: _event of_class _class
    where [ ],

  timer_info: equals 'Event Activity Report',
  timer_duration: _rep_freq,

  action: reset_activity: ( 
    print_event_activity,
    reset_event_activity,     
    set_timer(_event,_rep_freq,'Event Activity Report')
  )
). 

See Also

print_event_activity

reset_global_grp

Resets the value of all global variables in a group.

Synopsis

reset_global_grp(_group,_value)

Description

This predicate changes the value of all global variables in a group in the knowledge base. The predicate loops through the variables in the group and for each variable found, changes its value to _value.

Arguments

_group
The group key for the variables.
_value
The new value for the variables.

Examples

The following example resets all of the global variables in the Maintenance group to off.

reset_global_grp('Maintenance', 'off'),

See Also

set_global_var

resolve_time

Retrieves the attributes of a time structure.

Synopsis

resolve_time(_time_structure, _seconds, _minutes, _hours, _day_of_month, _month, _year, _day_of_week, _day_of_year, _daylight_saving)

Description

This predicate retrieves attributes from a time structure represented by the _time_structure argument, and instantiates the remaining arguments to those attributes. _time_structure must be instantiated before calling resolve_time. The other arguments must be free. The values are in Greenwich mean time (GMT).

Arguments

_day_of_month
Instantiated to an integer in the range 1-31.
_day_of_week
Instantiated to an integer in the range 0-6.
_day_of_year
Instantiated to an integer in the range 0-364.
_daylight_saving
Instantiated to an integer as reflected by the DST_ macros in <sys/time.h>.

You can use this number to determine the type of daylight savings time style used on the current system. This could be useful if you need to manipulate time values returned by this predicate. The following example shows the values from a Solaris system:

#define  DST_NONE    0  /* not on dst */
#define  DST_USA     1  /* USA style dst */
#define  DST_AUST    2  /* Australian style dst */
#define  DST_WET     3  /* Western European dst */
#define  DST_MET     4  /* Middle European dst */
#define  DST_EET     5  /* Eastern European dst */
#define  DST_CAN     6  /* Canada */
#define  DST_GB      7  /* Great Britain and Eire */
#define  DST_RUM     8  /* Rumania */
#define  DST_TUR     9  /* Turkey */
#define  DST_AUSTALT 10 /* Australian style with
                           shift in 1986 */
_hours
Instantiated to an integer in the range 0-23.
_minutes
Instantiated to an integer in the range 0-59.
_month
Instantiated to an integer in the range 0-11.
_seconds
Instantiated to an integer in the range 0-59.
_time_structure
Represents a time structure. Do not confuse it with the data returned by the get_time predicate, in which the value for the _time_epoch argument is a number representing how many seconds have passed since an epoch.
_year
Instantiated to an integer in the range 00-99.

Examples

The following example shows how to get the structure for the current local system time, retrieve the attributes of the local system time structure, and update the month attribute of the event with the value of the _month argument.

get_local_time(_time_local_struct),
resolve_time(_time_local_struct, _seconds, _minutes,
             _hours,
             _day_of_month, _month, _year, _day_of_week,
             _day_of_year, _daylight_savings),
bo_set_slotval(_event, month, _month)

See Also

bo_set_slotval, get_local_time

save_globals

Writes all global variables from a group to a file.

Synopsis

save_globals(_file, _group)

Description

This predicate writes all the global variables from a group to a file.

Arguments

_file
The path and file name to write the variables.
_group
The group key whose variables to write.

Examples

The following example shows how to write the global variables in the Maintenance group to a file:

save_globals('/tmp/globalvars.txt', 'Maintenance')

See Also

load_globals

search_cache

Performs a query of the event cache based on a named search defined with the create_cache_search_criteria predicate.

Synopsis

search_cache(search_name, _referenceEvent, _maxEvents, _foundEvent)

--OR--

search_cache(search_name, _referenceEvent, _timeBefore, _timeAfter, _maxEvents, _foundEvent)

Description

This predicate performs a query of the event cache. It is used in conjunction with the create_cache_search_criteria predicate, which defines a named search.

The second form of the predicate lets you specify a time window with the _timeBefore and _timeAfter arguments.

Succeeds once for each event that satisfies the search criteria.

You can use the get_attributes predicate to get the values for each found event's attributes.

Arguments

_foundEvent
A pointer to a matching event.
_maxEvents
The maximum number of events to return that meet the search criteria.
_referenceEvent
A pointer to the reference event, typically the event under analysis.
search_name
The name of the search criteria to use in the query. This name and its associated search criteria are defined with the create_cache_search_criteria predicate.
-timeAfter
The number of seconds after the reference event.
-timeBefore
The number of seconds before the reference event.

Examples

The following example uses the search named db_critical_search to find matching events within a 20 minute time window of the reference event. The search has been instructed to return no more than five matching events.

search_cache('db_critical_search',
             _refevent,
             600,
             600,
             5,
              _found_event)

See Also

create_cache_search_criteria

set_detailed_debugging

Writes rule trace information to the rule trace file for predicates.

Synopsis

set_detailed_debugging(on)

--OR--

set_detailed_debugging(off)

Description

This predicate toggles the writing of rule trace information for predicates that have rule tracing enabled with the trace_it predicate. You can run the set_detailed_debugging predicate from any rule.

Arguments

off
Specifies to not write rule trace information.
on
Specifies to write rule trace information.

Examples

The following example shows a user-defined predicate named my_predicate that receives an argument (_data) that is actually passed in as the argument to a user-defined predicate named check_data. The check_data predicate is the predicate to be debugged. The logic is as follows:

  1. Enable writing of the rule trace information to a file with the set_detailed_debugging predicate.
  2. Define a source location named my_predicate for a point of reference from an error message. This is done with the set_log_error_source predicate.
  3. Enable rule tracing of the check_data predicate with the trace_it predicate.
  4. If the check_data predicate fails, the log_error predicate is run and the Bad Data message along with the my_predicate source identifier are written to the error file. The tell_err predicate had to be run previously to define the location and name of the error file.

    Additionally when the check_data predicate fails, a TEC_Error event is sent to the event server with a severity of CRITICAL, the Bad Data message, and the my_predicate source identifier. The message and the source identifier are assigned to the msg attribute of the event.

Regardless of whether the predicate succeeds or fails, trace information is written to the rule trace file.

set_detailed_debugging(on),

my_predicate(_data):-
  set_log_error_source(my_predicate),

  (
    trace_it(check_data), 
    process_data(_data)

  ;
    log_error('Bad Data %s',[_data],'CRITICAL')
  )

See Also

None.

set_event_administrator

Sets the administrator for an event.

Synopsis

set_event_administrator(_event, new_administrator)

Description

This predicate sets the value for the administrator attribute for the specified event.

Note:
This predicate directly modifies the value of the attribute without issuing an internal change request that goes through the change rules. To trigger change rules, call the place_change_request predicate following the set_event_administrator call.

Arguments

_event
A pointer to the event for which the administrator is to be set.
new_administrator
Specifies the new administrator for the event.

Examples

The following example shows predicate usage:

set_event_administrator(_event, bjones)

See Also

change_event_administrator , place_change_request

set_event_message

Sets the msg attribute of an event.

Synopsis

set_event_message(_event, _format, [_value])

Description

The format specification is similar to that for the sprintf() function in the C programming language.

Note:
This predicate directly modifies the value of the attribute without issuing an internal change request that goes through the change rules. To trigger change rules, call the place_change_request predicate following the set_event_message call.

Arguments

_event
A pointer to the event containing the msg attribute to assign the value.
_format
The format specification for the msg attribute value. The following conversion specifications are valid:
%c
Character.
%d
Integer printed in decimal notation.
%e
Real printed in exponential notation.
%f
Real printed in decimal notation.
%g
Real printed in its shortest form (decimal or exponential notation).
%o
Integer printed in octal notation, without sign and leading zero.
%s
String.
%u
Integer printed in unsigned decimal notation.
%x
Integer printed in hexadecimal notation, without sign and leading 0x.

You can specify more detailed conversion specifications between the % sign and the conversion character, as follows:

-
Left adjustment.
0
Zero padding to the left.
n
In cases of an integer or a string, n is the minimum length of the field.
n.m
In cases of a real, n is the minimum length of the field and m indicates the number of digits after the decimal point.
_value
The text to be formatted for the msg attribute. This argument is in list format.

Examples

The following example shows various uses of the predicate:

_integer is 123,
_real is 12.3,
_string = 'Hello, World',
% Assign values.

set_event_message(_event, '%s', [_string]),
% msg attribute assigned 'Hello, World'.

set_event_message(_event, '%20s', [_string]),
% msg attribute assigned '        Hello, World'.

set_event_message(_event, '%-20s', [_string]),
% msg attribute assigned 'Hello, World        '.


set_event_message(_event, 'Integer in decimal notation:
 %d', [_integer]),
% msg attribute assigned 'Integer in decimal
% notation: 123'.

set_event_message(_event, 'Integer in decimal notation
 with field width: %10d', [_integer]),
% msg attribute assigned 'Integer in decimal
% notation with field width:        123'

set_event_message(_event, 'Integer in decimal notation
with leading zeros: %010d', [_integer]),
% msg attribute assigned 'Integer in decimal
% notation with leading zeros: 0000000123'.

set_event_message(_event, 'Integer in octal notation:
%o', [_integer]),
% msg attribute assigned 'Integer in octal
% notation: 173'.

set_event_message(_event, 'Integer in hexadecimal notation:
%x', [_integer]),
% msg attribute assigned 'Integer in hexadecimal
% notation: 7b'

set_event_message(_event, 'Real in decimal notation:
%f', [_real]),
% msg attribute assigned 'Real in decimal
% notation: 12.300000'.

set_event_message(_event, 'Real in decimal notation with
field width: %3.2f', [_real]),
% msg attribute assigned 'Real in decimal
% notation with field width: 12.30'.

set_event_message(_event, 'Real in real notation:
%f', [_real]),
% msg attribute assigned 'Real in real notation:
% 12.300000'.

set_event_message(_event, 'Real in exponential notation:
%e', [_real]),
% msg attribute assigned 'Real in exponential
% notation: 1.230000e+01'.

set_event_message(_event, 'Real in its shortest form:
%g', [_real])
% msg attribute assigned 'Real in its shortest form: 12.3'.

See Also

place_change_request

set_event_severity

Sets the severity of an event.

Synopsis

set_event_severity(_event, new_severity)

Description

This predicate sets the severity of the specified event.

Note:
This predicate directly modifies the value of the attribute without issuing an internal change request that goes through the change rules. To trigger change rules, call the place_change_request predicate following the set_event_severity call.

Arguments

_event
A pointer to the event for which the severity is to be set.
new_severity
The new event severity.

Examples

The following example shows predicate usage:

set_event_severity(_event, 'CRITICAL')

See Also

change_event_severity , place_change_request

set_event_status

Sets the status of an event.

Synopsis

set_event_status(_event, new_status)

Description

This predicate sets the status attribute of the specified event.

Notes:
  1. This predicate directly modifies the value of the applicable event attribute without issuing an internal change request that goes through the change rules. To trigger change rules, call the place_change_request predicate following the set_event_status call.
  2. If the status attribute was set to a value of CLOSED by this predicate, the duration attribute is not modified to provide the age. The value remains at 0. See duration for additional information.

Arguments

_event
A pointer to the event for which the status is to be set.
new_status
The new value to assign the status attribute. Valid values for the status attribute are described on page ***.
Notes:
  1. You cannot change a status of CLOSED.
  2. A change from ACK to OPEN status is not valid for the new_status argument.

Examples

The following example shows how to set the status attribute of the event under analysis to ACK:

set_event_status(_event, 'ACK')

See Also

change_event_status, place_change_request

set_global_var

Sets the value of a global variable.

Synopsis

set_global_var(_group, _key,_value)

Description

This predicate sets the value of one global variable in the knowledge base. To set a variable to a list, use the [ ] notation.

Arguments

_group
The group key for the variable.
_key
The key for the variable.
_value
The value to set.

Examples

The following example shows various uses of the predicate:

set_global_var('My group key', _key, 'My value')
set_global_var('My group key', _key, ['a', 'b', 'c'])
set_global_var('Maintenance', _origin, 'on')

See Also

reset_global_grp

set_log_error_source

Defines a source identifier for a point of reference from an error message generated by the log_error predicate.

Synopsis

set_log_error_source('source_location')

Description

This predicate defines a source location within a rule action so you have a point of reference from a generated error message to help you debug the rule. For the argument, specify the name of a rule action or other significant identifier (for example, a predicate name).

Arguments

source_location
A string identifying a meaningful location in a rule.

Examples

The following example shows a user-defined predicate named my_predicate that receives an argument (_data) that is actually passed in to be the argument of a user-defined predicate named check_data. The check_data predicate is the predicate to be debugged. The logic is as follows:

  1. Define a source location named my_predicate for a point of reference from an error message. This is done with the set_log_error_source predicate.
  2. Enable rule tracing of the check_data predicate with the trace_it predicate. To actually write the rule trace information to a file, the set_detailed_debugging predicate had to be run previously. The trace_it predicate just enables tracing.
  3. If the check_data predicate fails, the log_error predicate is run and the Bad Data message along with the my_predicate source identifier are written to the error file. The tell_err predicate had to be run previously to define the location and name of the error file.

    Additionally when the check_data predicate fails, a TEC_Error event is sent to the event server with a severity of CRITICAL, the Bad Data message, and the my_predicate source identifier. The message and the source identifier are assigned to the msg attribute of the event.

my_predicate(_data):-
  set_log_error_source(my_predicate),

  (
    trace_it(check_data), 
    process_data(_data)

  ;
    log_error('Bad Data %s',[_data],'CRITICAL')
  )

    
)

See Also

log_error

set_timer

Sets a timer on an event.

Synopsis

set_timer(_event, timer_duration, timer_info)

Description

This predicate sets a timer on a received event. When the timer expires, the rule engine finishes processing the current event and then triggers timer rules for the specified event. In essence, the expiration of a timer is a transaction requesting the execution of timer rules on a specified event.

The maximum number of active timers that can be placed on events with this predicate is 1000.

An event of class TEC_Tick always exists in the event cache; that is, it is never aged out of the event cache. You can search for this event in the cache and use it to start a timer, knowing that it will always be there.

Arguments

_event
A pointer to the event on which the timer is being set.
timer_duration
The duration (in seconds) of the timer. It can also be used for event filtering in a timer rule.
timer_info
The timer information. This argument can be anything, such as an integer, a string, or a structured item. It can be used for event filtering in a timer rule.

Examples

The first rule in the following example initially sets the timer for event activity report generation. The second rule is evaluated whenever the timer expires for event activity reporting. The action in the second rule prints the event activity report, resets counters for the next event activity report, and sets a new timer for generation of the next event activity report.

rule: (

  event: _event of_class 'TEC_Start'
    where [ ],

  reception_action: (
    first_instance(event:_ev of_class 'TEC_Tick' where []),
   set_timer(_event, 600, 'Event Activity Report')  )
).

timer_rule: reset_print_activity: (
  event: _event of_class _class
    where [ ],

    timer_info: equals 'Event Activity Report',
    timer_duration: _rep_freq,

  action: reset_print_activity: ( 
    print_event_activity,
    reset_event_activity,     
    set_timer(_event,_rep_freq,'Event Activity Report'
  )
).

See Also

None.

trace_it

Enables tracing of user-defined predicates.

Synopsis

trace_it(predicate_name)

Description

This predicate designates which user-defined predicates to trace.

Note:
Do not use this predicate to enable tracing for anything but predicates you have created.

Arguments

predicate_name
The name of the predicate to trace.

Examples

The following example shows a user-defined predicate named my_predicate that receives an argument (_data) that is actually passed in to be the argument of a user-defined predicate named check_data. The check_data predicate is the predicate to be debugged. The logic is as follows:

  1. Define a source location named my_predicate for a point of reference from an error message. This is done with the set_log_error_source predicate.
  2. Enable tracing of the check_data predicate with the trace_it predicate. To actually write the rule trace information to a file, the set_detailed_debugging predicate had to be run previously. The trace_it predicate just enables tracing.
  3. If the check_data predicate fails, the log_error predicate is run and the Bad Data message along with the my_predicate source identifier are written to the error file. The tell_err predicate had to be run previously to define the location and name of the error file.

    Additionally when the check_data predicate fails, a TEC_Error event is sent to the event server with a severity of CRITICAL, the Bad Data message, and the my_predicate source identifier. The message and the source identifier are assigned to the msg attribute of the event.

my_predicate(_data):-
  set_log_error_source(my_predicate),

  (
    trace_it(check_data), 
    process_data(_data)

  ;
    log_error('Bad Data %s',[_data],'CRITICAL')
  )

    
)

See Also

set_detailed_debugging

unlink_from_cause

Unlinks an effect event from a cause event.

Synopsis

unlink_from_cause(_effect_event)

Description

This predicate updates the cause_date_reception and cause_event_handle attributes of the effect event to a value of 0, breaking the link between the two events.

Arguments

_effect_event
The event to be unlinked.

Examples

The following example shows predicate usage:

unlink_from_cause(_oserv_down_event)

See Also

link_effect_to_cause

update_event_activity

Captures event information for reporting by the print_event_activity_report predicate.

Synopsis

update_event_activity(_event)

Description

This predicate captures information from an event and stores it internally for later reporting. It is typically called in a rule that runs on every event class.

Arguments

_event
A pointer to the reference event, which is typically the event under analysis.

Examples

The following example shows a use of the predicate:

rule: update_event_activity: (

  event: _event of_class _class
    where [ ],

  reception_action: update_activity: ( 
    % recorded(event_activity,active),
    % Line above used with im.rls (intermediate mgr. rules)

    update_event_activity(_event)
  )
). 

See Also

print_event_activity


[ Top of Page | Previous Page | Next Page | Contents | Index ]