|
View previous topic :: View next topic |
Author |
Message |
Harry
Joined: 10 Oct 2018 Posts: 8
|
Posted: Wed Mar 17, 2021 8:43 am Post subject: Action profile repeated based on time action was executed |
|
|
I'm looking for a way to execute an alert profile step repeated every x time while a test status is bad.
For example, sent email every occurrence the test is bad, but not more often than once an hour.
This same alert profile should work for several tests with different intervals
I've tried the following in the advanced start condition for an action step:
('%SimpleStatus%'=='DOWN') AND ((%Recurrences% * %Interval_Min%) mod 60 == 0)
This trick will fulfill my requirement in most cases. But it depends on 60 should be divisible by the test interval. For example with a 11 minutes test interval this mod 60 trick won't work as 11 would not fit multiple times into 60. Only test interval with 1, 2, 3, 4, 5, 6, 10, 12, 15, 30, 60 minutes will do the trick
Therefore I was looking at some variable which can be used like %ActionStepLastTimeExecuted_Min%. Which contains the number of minutes this action was executed ago last time.
Then you can simply have this kind of condition defined in the step:
('%SimpleStatus%'=='DOWN') AND (%ActionLastTimeExecuted_Min% > 60) |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Wed Mar 17, 2021 3:59 pm Post subject: |
|
|
We have similar task in "to do " list but its not easy task, requires some redesign..
Regards
Alex |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Harry
Joined: 10 Oct 2018 Posts: 8
|
Posted: Fri Mar 19, 2021 2:25 am Post subject: |
|
|
In the meantime I've improved the formula. Still not ideal, but maybe for a reference if someone looking for the same kind of example.
('%SimpleStatus%'=='DOWN') AND (%Recurrences% > 1) AND (
( %Interval_Min% <= 6 AND ((%Recurrences% * %Interval_Min%) mod 60 == 0 )) OR
( %Interval_Min% >= 7 AND %Interval_Min% < 20 AND ((%Recurrences% * (%Interval_Min% div 5)*5 ) mod 60 == 0 )) OR
( %Interval_Min% >= 20 AND %Interval_Min% < 30 AND ((%Recurrences% * (%Interval_Min% div 20)*20 ) mod 60 == 0 )) OR
( %Interval_Min% >= 30 AND ((%Recurrences% * (%Interval_Min% div 30)*30 ) mod 60 == 0 )) )
Comment per line:
1) In some ocasions it's occurs the action will be hit on first recurrence, this %Recurrences% > 1 will skip the action on first hit
2) For interval 1, 2, 3, 4, 5, 6. This interval will fit into 60
3) For interval 7 untill 19. This interval will be handled as per 5 minutes interval. 7, 8, 9 will be seen as 5 minutes. 10 -14 will be seen as 10 minutes interval and 15-19 will be seen as 15 minutes interval in respect to the mod 60 calculation. (%Interval_Min% div 5)*5 will do this trick
4) For interval 20 - 29, this will be seen as 20 minutes interval
5) For interval 30 and higher will be seen as interval is 30 or multiple times 30. for example 45 will be seen as 30, but 70 minutes will be seen as 60.
Examples:
Interval of 7 minutes will be handled as 5 minutes. After 12 recurrences (60/5=12) this action will be executed. This will be executed every 12 * 7 = 84 minutes. Note: Action will not hit on every 9 recurrences (9 * 7 = 63), despite this is most close to the 60 minutes.
Interval of 27 minutes will be handled as 20 minutes. After 3 recurrences (60/20=3) this action will be executed. This will be executed every 3 * 27 = 81 minutes
In case you want to executed the action not more than once in the 6 hours (360 minutes), simply replace mod 60 parts with mod 360. and so on, as long as the number xx in "mod xx" is divisible by 60.
As I say, not the most ideal solution, but at least it comes near the repeat an action every hour, or 4 times a day if you do mod 360 |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Fri Mar 19, 2021 10:14 am Post subject: |
|
|
Thank you for solution!
Regards
Alex |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|