On 04/21/2012 02:21 AM, mindman101 wrote:
> Hello list!
>
> I configured three single rules: the first one trigger a context and the
> next two add a text to the context when there is a match.
>
> In the first rule I copied the content of the context to a variable.
>
> I know I should use a miniperl program to do what I need, but I don't
> have any experience in perl. The problem is:
>
> How can I evaluate the variable h to know whether is empty or not? If it
> is empty do nothing, if not empty, create an event.

Unfortunately, conditional execution is not currently supported in 
action lists. Nevertheless, you could implement this logic through 
contexts (or context aliases). Also, the original rules need 
modification anyway, since 'add' creates a context with infinite 
lifetime if it does not exist.

type=Single
ptype=RegExp
pattern=linkDown (\S+) on interface (\S+)
desc=There is a link down on $1 on $2
action=create linkDown 3 (event ReportLinkDown)

type=Single
ptype=RegExp
pattern=^(RsvpIfStateChange).+
context=linkDown
desc=$0
action=add linkDown RsvpIfStateChange; alias linkDown linkDownHasData

type=Single
ptype=RegExp
pattern=^(RsvpIfNbrStateDown).+
context=linkDown
desc=$0
action=add linkDown RsvpIfNbrStateDown; alias linkDown linkDownHasData

type=Single
ptype=RegExp
pattern=ReportLinkDown
context=linkDownHasData
desc=report the linkdown context that has data
action=copy linkDown %h; event %h

An alias linkDownHasData is an indication that at least one event has 
been added to linkDown context. The alias is another name for linkDown 
which gets dropped when linkDown itself expires, so no separate deletion 
is necessary.

regards,
risto

>
> I have this:
>
> type=Single
> ptype=RegExp
> pattern=linkDown (\S+) on interface (\S+)
> desc=There is a link down on $1 on $2
> action=create linkDown 3 (copy linkDown %h; <- is %h empty ->; event %s %h)
>
>
> type=Single
> ptype=RegExp
> pattern=^(RsvpIfStateChange).+
> desc=$0
> action=add linkDown RsvpIfStateChange
>
>
> type=Single
> ptype=RegExp
> pattern=^(RsvpIfNbrStateDown).+
> desc=$0
> action=add linkDown RsvpIfNbrStateDown
>
> Thanks.
>
> Raul.
>
>
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
>
>
>
> _______________________________________________
> Simple-evcorr-users mailing list
> Simple-evcorr-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to