KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Logical expression to start action

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
georgyiii



Joined: 18 Mar 2015
Posts: 6

PostPosted: Wed Mar 18, 2015 2:47 am    Post subject: Logical expression to start action Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Wed Mar 18, 2015 4:09 am    Post subject: Reply with quote

%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
View user's profile Send private message Send e-mail Visit poster's website
georgyiii



Joined: 18 Mar 2015
Posts: 6

PostPosted: Wed Mar 18, 2015 4:17 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Wed Mar 18, 2015 4:52 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
georgyiii



Joined: 18 Mar 2015
Posts: 6

PostPosted: Wed Mar 18, 2015 5:19 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Wed Mar 18, 2015 5:52 am    Post subject: Reply with quote

In such case expression should look like the following:
('%SimpleStatus%'=='DOWN') and (%PreviousStatusDuration_Sec%+%CurrentStatusDuration_sec% < 1800)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
georgyiii



Joined: 18 Mar 2015
Posts: 6

PostPosted: Wed Mar 18, 2015 6:59 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Wed Mar 18, 2015 7:31 am    Post subject: Reply with quote

You are welcome!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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

KS-Soft Forum Index