Back to Geneos FAQ

Rules - How to create a rule that can trigger an action for 2 specific periods while the value continues to be above the threshold from the first period to the second period

The solution is to define an active time with the 2 active periods and in the rule block set the severity to critical only if the value is above the threshold and within the active time.

Example: I have a toolkit that runs every 20 sec but need to fire an email script if the execution time is above 10 sec during 09:29 to 09:30 and 09:32: to 09:33.

1- create the below active time:

<activeTime name="2_active_periods">
<scheduledPeriod>
<startTime>09:27:00</startTime>
<endTime>09:30:00</endTime>
</scheduledPeriod>
<scheduledPeriod>
<startTime>09:32:00</startTime>
<endTime>09:33:00</endTime>
</scheduledPeriod>
</activeTime>

2- Apply the active time in the rule block. The effect is the severity will change to OK once it is at the end of each of the above active periods.

if value > 10 and within activetime "2_active_periods" then
 severity critical
 run "Email1"
else
 severity ok
endif

During the first active period, 09:29 to 09:30, the rule fires the action as below and removes the action applied to the rule at the end of the period. The cell becomes critical then goes green at end of the first active period.

Gateway log:

<Thu May 16 09:29:00> INFO: ActionManager Action DataItem 'Email1' generated (variable=/geneos/gateway[(@name="GW2_klee_51135")]/directory/probe[(@name="nysupsvr1f_161114_61135")]/managedEntity[(@name="nysupsvr1f_161114_61135")]/sampler[(@name="Toolkit_parseDate")][(@type="")]/dataview[(@name="Toolkit_parseDate")]/headlines/cell[(@name="execDuration")])
<Thu May 16 09:29:00> INFO: ActionManager Firing action 'Email1'
<Thu May 16 09:29:02> INFO: ActionManager Finished executing '/export/home/klee/email1.pl' with arguments 'klee@itrsgroup.com'.
<Thu May 16 09:29:02> INFO: ActionManager Completed action 'Email1', Exit code: 0

<Thu May 16 09:30:00> INFO: ActionManager Action DataItem 'Email1' removed (variable=/geneos/gateway[(@name="GW2_klee_51135")]/directory/probe[(@name="nysupsvr1f_161114_61135")]/managedEntity[(@name="nysupsvr1f_161114_61135")]/sampler[(@name="Toolkit_parseDate")][(@type="")]/dataview[(@name="Toolkit_parseDate")]/headlines/cell[(@name="execDuration")])

During the second active period, 09:32 to 09:33, the rule fires the action as below and removes the action applied to the rule at the end of the period. The cell becomes critical then goes green at end of the second active period.

Gateway log:

<Thu May 16 09:32:00> INFO: ActionManager Action DataItem 'Email1' generated (variable=/geneos/gateway[(@name="GW2_klee_51135")]/directory/probe[(@name="nysupsvr1f_161114_61135")]/managedEntity[(@name="nysupsvr1f_161114_61135")]/sampler[(@name="Toolkit_parseDate")][(@type="")]/dataview[(@name="Toolkit_parseDate")]/headlines/cell[(@name="execDuration")])
<Thu May 16 09:32:00> INFO: ActionManager Firing action 'Email1'
<Thu May 16 09:32:02> INFO: ActionManager Finished executing '/export/home/klee/email1.pl' with arguments 'klee@itrsgroup.com'.
<Thu May 16 09:32:02> INFO: ActionManager Completed action 'Email1', Exit code: 0

<Thu May 16 09:33:00> INFO: ActionManager Action DataItem 'Email1' removed (variable=/geneos/gateway[(@name="GW2_klee_51135")]/directory/probe[(@name="nysupsvr1f_161114_61135")]/managedEntity[(@name="nysupsvr1f_161114_61135")]/sampler[(@name="Toolkit_parseDate")][(@type="")]/dataview[(@name="Toolkit_parseDate")]/headlines/cell[(@name="execDuration")])
["Geneos"] ["Geneos > Gateway"] ["FAQ"]

Was this topic helpful?