Using a SPECTRUM Event Procedure to assert event based on time
search cancel

Using a SPECTRUM Event Procedure to assert event based on time

book

Article ID: 51985

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

We have a requirement for an event to check the time the event was generated. If the event was generated between specific times, we wanted an alarm. If outside those times, no alarm.

Environment

Release: Any
Component: Events and Alarms

Resolution

The following is a sample Event Procedure that will check the current time when event 0xffff0000 is asserted. If the time is between 8:00 AM and 5:00 PM (0800 - 1700), event 0xffff0001 will be created. If not, event 0xffff0002 will be created. The times use the 24 hour clock time and can be changed to meet individual needs.

The event variables from the 0xffff0000 event are passed to the resulting event (0xffff0001 or 0xffff0002).

 

0xffff0000 E 0 P " \
  If( \
    And ( \
        GreaterOrEqual( GetHour( GetCurrentTime() ), \
                                 { U 18 } ), \
        LessOrEqual( GetHour( GetCurrentTime() ), \
                                { U 21 } ) ), \
    CreateEventWithVariables( { C CURRENT_MODEL }, \
                       { H 0xffff0001 } , \
    GetEventVariableList() ), \
    CreateEventWithVariables( { C CURRENT_MODEL }, \
                       { H 0xffff0002 } , \
    GetEventVariableList() ))"