Logical expression to start action

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
georgyiii
Posts: 6
Joined: Wed Mar 18, 2015 2:22 am

Logical expression to start action

Post by georgyiii »

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?
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

%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/mfra ... #currmacro
georgyiii
Posts: 6
Joined: Wed Mar 18, 2015 2:22 am

Post by georgyiii »

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.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

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?
georgyiii
Posts: 6
Joined: Wed Mar 18, 2015 2:22 am

Post by georgyiii »

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
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

In such case expression should look like the following:
('%SimpleStatus%'=='DOWN') and (%PreviousStatusDuration_Sec%+%CurrentStatusDuration_sec% < 1800)
georgyiii
Posts: 6
Joined: Wed Mar 18, 2015 2:22 am

Post by georgyiii »

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!
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You are welcome!
Post Reply