I am trying to set up an active/standby or active/passive SEC pair, and 
use context to indicate which side should be active or passive.  I am 
having a problem with the context check, comparing the string of $1 
against %Side, and I am not getting what I would expect.

The exercise creates two questions for me.  How do you compare context 
variables in a context expession?  Is there a simpler more elegant way 
to do active/passive pairing, and signal in-band an active/passive 
switchover?

Please advise,
Tim Peiffer

oit200959393:examples peiffer$ cat ActiveStandby.cfg
#
# Rule1: Determine whether you are set1 (odd) or set2 (even)
#
#
type=single
desc=Determine Set1 or Set2
ptype=RegExp
pattern=SEC_(STARTUP|RESTART|SOFTRESTART)
context=[ SEC_INTERNAL_EVENT ]
action= \
     assign %Side set1 ; \
     create ACTIVE_%Side

#
# Rule2: use the context to test whether side is active
#
type=single
ptype=RegExp
pattern=test (\S+) side
desc=side $1 active
context=ACTIVE_%Side && ("$1" eq "%Side);
action=logonly this side %Side is active
#
# Rule3: use the context to test whether side is passive
#
type=single
ptype=RegExp
pattern=test (\S+) side
desc=side $1 passive
context=!ACTIVE_%Side || ("$1" ne "%Side);
action=logonly this side $1 is passive

oit200959393:examples peiffer$ ../sec.pl -conf ./ActiveStandby.cfg 
-input=- -log=- -debug=7 -intevents
SEC (Simple Event Correlator) 2.5.3
Sun Nov  7 17:28:43 2010: SEC (Simple Event Correlator) 2.5.3
Reading configuration from ./ActiveStandby.cfg
Sun Nov  7 17:28:43 2010: Reading configuration from ./ActiveStandby.cfg
3 rules loaded from ./ActiveStandby.cfg
Sun Nov  7 17:28:43 2010: 3 rules loaded from ./ActiveStandby.cfg
Stdin connected to terminal, SIGINT can't be used for changing the 
logging level
Sun Nov  7 17:28:43 2010: Stdin connected to terminal, SIGINT can't be 
used for changing the logging level
Creating SEC internal context 'SEC_INTERNAL_EVENT'
Sun Nov  7 17:28:43 2010: Creating SEC internal context 'SEC_INTERNAL_EVENT'
Creating SEC internal event 'SEC_STARTUP'
Sun Nov  7 17:28:43 2010: Creating SEC internal event 'SEC_STARTUP'
Assigning 'set1' to variable '%Side'
Sun Nov  7 17:28:43 2010: Assigning 'set1' to variable '%Side'
Creating context 'ACTIVE_set1'
Sun Nov  7 17:28:43 2010: Creating context 'ACTIVE_set1'
Deleting SEC internal context 'SEC_INTERNAL_EVENT'
Sun Nov  7 17:28:43 2010: Deleting SEC internal context 'SEC_INTERNAL_EVENT'
test set1 side
this side set1 is passive
Sun Nov  7 17:28:50 2010: this side set1 is passive
test set2 side
this side set2 is passive
Sun Nov  7 17:28:53 2010: this side set2 is passive

-- 
Tim Peiffer
Network Support Engineer
Office of Information Technology
University of Minnesota/NorthernLights GigaPOP

+1 612 626-7884 (desk)


------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to