On 2013-10-24, Andy <a...@brandwatch.com> 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.<interface_id> (though it would be a useful extra feature for snmpd if it could respond to interface link changes and send out traps..)