View previous topic :: View next topic |
Author |
Message |
georgyiii
Joined: 18 Mar 2015 Posts: 6
|
Posted: Wed Mar 18, 2015 2:47 am Post subject: Logical expression to start action |
|
|
Hi! I want to start action based on time difference between test previous status change and current status change time. For example i need to set snmp value if time difference last status change and current status time is less than 30 minutes. I try to use expression: ('%SimpleStatus%'=='DOWN') and ('%StatusChangedTime%'-'%PreviousStatusTime%'<00:30:00)
But it didn't work
What i do wrong? How i can trigger action based on time difference? |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Mar 18, 2015 4:09 am Post subject: |
|
|
%StatusChangedTime% and %PreviousStatusTime% variables return string/text values.
They can be compared, but cannot be calculated (added, subtracted ,etc)
As I understand you correctly, you need to use expression like the following:
('%SimpleStatus%'=='DOWN') and ('%CurrentStatusDuration%' < '00:30:00')
or
('%SimpleStatus%'=='DOWN') and (%CurrentStatusDuration_sec% < 1800)
Please check for details at:
http://www.ks-soft.net/hostmon.eng/mframe.htm#actions.htm#currmacro |
|
Back to top |
|
|
georgyiii
Joined: 18 Mar 2015 Posts: 6
|
Posted: Wed Mar 18, 2015 4:17 am Post subject: |
|
|
KS-Soft Europe wrote: |
As I understand you correctly, you need to use expression like the following:
('%SimpleStatus%'=='DOWN') and ('%CurrentStatusDuration%' < '00:30:00')
|
This is not exactly what i need. For example - test going down then up. If after that test going down within 30 minutes then i need trigger an action. |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Mar 18, 2015 4:52 am Post subject: |
|
|
Could you make some examples to explain what you need?
E.g.
10:00:00 TestItem01 Status: Ok
10:20:00 TestItem01 Status: Bad <Start Action/Alert>
10:40:00 TestItem01 Status: Bad <No Action should be triggered>
11:00:00 TestItem01 Status: Ok
11:35:00 TestItem01 Status: Bad <No Action should be triggered>
11:55:00 TestItem01 Status: Bad <No Action should be triggered>
Is this correct example? |
|
Back to top |
|
|
georgyiii
Joined: 18 Mar 2015 Posts: 6
|
Posted: Wed Mar 18, 2015 5:19 am Post subject: |
|
|
KS-Soft Europe wrote: | Could you make some examples to explain what you need?
|
Example1:
10:00:00 TestItem01 Status: Ok
10:20:00 TestItem01 Status: Bad <No Action should be triggered>
10:40:00 TestItem01 Status: Ok
10:45:00 TestItem01 Status: Bad <Start Action/Alert>
In this example between current bad and last Ok status took less than 30 minutes and i need start action
Example2:
10:00:00 TestItem01 Status: Ok
10:20:00 TestItem01 Status: Bad <No Action should be triggered>
10:40:00 TestItem01 Status: Ok
11:15:00 TestItem01 Status: Bad <No Action should be triggered>
In this example between current bad and last Ok status took more than 30 minutes and no action should be triggered
I want to catch often bad/ok status changes |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Mar 18, 2015 5:52 am Post subject: |
|
|
In such case expression should look like the following:
('%SimpleStatus%'=='DOWN') and (%PreviousStatusDuration_Sec%+%CurrentStatusDuration_sec% < 1800) |
|
Back to top |
|
|
georgyiii
Joined: 18 Mar 2015 Posts: 6
|
Posted: Wed Mar 18, 2015 6:59 am Post subject: |
|
|
KS-Soft Europe wrote: | In such case expression should look like the following:
('%SimpleStatus%'=='DOWN') and (%PreviousStatusDuration_Sec%+%CurrentStatusDuration_sec% < 1800) |
Works great! Thank you! |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Mar 18, 2015 7:31 am Post subject: |
|
|
You are welcome! |
|
Back to top |
|
|
|