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.

Reply via email to