Re: Notifies on CARP failover

2013-10-29 Thread Andy

Thanks for ideas and examples guys :)

Cheers, Andy.


On 24/10/13 14:18, Comète wrote:

I use ifstated for that. This is my config file:

init-state auto

carp_up = "carp3.link.up && carp10.link.up && carp101.link.up && 
carp100.link.up && carp254.link.up && carp2.link.up && carp7.link.up 
&& carp4.link.up"


carp_down = "carp3.link.down && carp10.link.down && carp101.link.down 
&& carp100.link.down && carp254.link.down && carp2.link.down && 
carp7.link.down && carp4.link.down"


state auto {
if $carp_up {
set-state primary
}
if $carp_down {
set-state backup
}
}

state primary {
init {
run "/root/scripts/alert_ifstated.sh MASTER"
}

if $carp_down {
set-state backup
}
}

state backup {
init {
run "/root/scripts/alert_ifstated.sh BACKUP"
}

if $carp_up {
set-state primary
}
}

This is the little script "alert_ifstated.sh" too:

#/bin/sh
ifconfig carp | mail -s "[RTR Failover] `hostname` is now $1" 
m...@address.me



Hope this helps...

Morgan


Le 24/10/2013 10:59, Andy a écrit :

Hi,

Could anyone point me in the right direction on how to have a script
be executed whenever a CARP failover or preempt event occurs?

Need to write a script to send an event message into our monitoring
systems so we can see when a change has occurred.

I haven't used ifstated yet, is this the right tool for this? and if
so could someone throw me an example if you have one?

Thanks, Andy.




Re: Notifies on CARP failover

2013-10-24 Thread Dag Richards

Andy wrote:

Hi,

Could anyone point me in the right direction on how to have a script be 
executed whenever a CARP failover or preempt event occurs?


Need to write a script to send an event message into our monitoring 
systems so we can see when a change has occurred.


I haven't used ifstated yet, is this the right tool for this? and if so 
could someone throw me an example if you have one?


Thanks, Andy.



read the ifstated man page and the man for ifstated.conf

That should get you there.



--
IS-IS sleeps.
BGP peers are quiet.
Something must be wrong.



Re: Notifies on CARP failover

2013-10-24 Thread Comète

I use ifstated for that. This is my config file:

init-state auto

carp_up = "carp3.link.up && carp10.link.up && carp101.link.up && 
carp100.link.up && carp254.link.up && carp2.link.up && carp7.link.up && 
carp4.link.up"


carp_down = "carp3.link.down && carp10.link.down && carp101.link.down && 
carp100.link.down && carp254.link.down && carp2.link.down && 
carp7.link.down && carp4.link.down"


state auto {
if $carp_up {
set-state primary
}
if $carp_down {
set-state backup
}
}

state primary {
init {
run "/root/scripts/alert_ifstated.sh MASTER"
}

if $carp_down {
set-state backup
}
}

state backup {
init {
run "/root/scripts/alert_ifstated.sh BACKUP"
}

if $carp_up {
set-state primary
}
}

This is the little script "alert_ifstated.sh" too:

#/bin/sh
ifconfig carp | mail -s "[RTR Failover] `hostname` is now $1" 
m...@address.me



Hope this helps...

Morgan


Le 24/10/2013 10:59, Andy a écrit :

Hi,

Could anyone point me in the right direction on how to have a script
be executed whenever a CARP failover or preempt event occurs?

Need to write a script to send an event message into our monitoring
systems so we can see when a change has occurred.

I haven't used ifstated yet, is this the right tool for this? and if
so could someone throw me an example if you have one?

Thanks, Andy.




Re: Notifies on CARP failover

2013-10-24 Thread Stuart Henderson
On 2013-10-24, Andy  wrote:
> Hi,
>
> Could anyone point me in the right direction on how to have a script be 
> executed whenever a CARP failover or preempt event occurs?
>
> Need to write a script to send an event message into our monitoring 
> systems so we can see when a change has occurred.
>
> I haven't used ifstated yet, is this the right tool for this? and if so 
> could someone throw me an example if you have one?

Lots of options, ifstated is certainly a useful one, as is shipping syslog to
a remote machine and monitoring that. Note that a script is going to rely on 
fork()
working, which might not be the case in some failure modes (whereas some other
methods will just work with a long-running process).

Personally to do this, I'd probably run snmpd and use an snmp probe to watch
iso.org.dod.internet.private.enterprises.openBSD.carpMIBObjects.
(though it would be a useful extra feature for snmpd if it could respond to
interface link changes and send out traps..)



Re: Notifies on CARP failover

2013-10-24 Thread Kārlis Miķelsons

Hello,


Could anyone point me in the right direction on how to have a script
be executed whenever a CARP failover or preempt event occurs?

Need to write a script to send an event message into our monitoring
systems so we can see when a change has occurred.

I haven't used ifstated yet, is this the right tool for this? and if
so could someone throw me an example if you have one?

I know people don't like calomel.org suggestions here, but this
example has been working fine for me:
  https://calomel.org/ifstated.html


--
Karlis



Notifies on CARP failover

2013-10-24 Thread Andy

Hi,

Could anyone point me in the right direction on how to have a script be 
executed whenever a CARP failover or preempt event occurs?


Need to write a script to send an event message into our monitoring 
systems so we can see when a change has occurred.


I haven't used ifstated yet, is this the right tool for this? and if so 
could someone throw me an example if you have one?


Thanks, Andy.