add notify script

This commit is contained in:
Bertrand Gouny
2015-06-16 14:06:49 +02:00
parent a7a68de0df
commit 84c261f102
3 changed files with 27 additions and 9 deletions
@@ -1,4 +1,12 @@
vrrp_instance vip-1 {
vrrp_sync_group VG_1 {
group {
VI_1
}
{{ keepalived_notify }}
}
vrrp_instance VI_1 {
interface {{ keepalived_interface }}
track_interface {
@@ -22,6 +30,4 @@ vrrp_instance vip-1 {
auth_type PASS
auth_pass {{ keepalived_password }}
}
{{ keepalived_notify }}
}
@@ -1,20 +1,31 @@
#!/bin/bash
# for ANY state transition.
# "notify" script is called AFTER the
# notify_* script(s) and is executed
# with 3 arguments provided by keepalived
# (ie don't include parameters in the notify line).
# arguments
# $1 = "GROUP"|"INSTANCE"
# $2 = name of group or instance
# $3 = target state of transition
# ("MASTER"|"BACKUP"|"FAULT")
TYPE=$1
NAME=$2
STATE=$3
case $STATE in
"MASTER") echo "I'm the MASTER! Whup whup."
"MASTER") echo "I'm the MASTER! Whup whup." >> keepalived.info
exit 0
;;
"BACKUP") "Ok, i'm just a backup, great."
"BACKUP") "Ok, i'm just a backup, great." >> keepalived.info
exit 0
;;
"FAULT") echo "Fault, what ?"
"FAULT") echo "Fault, what ?" >> keepalived.info
exit 0
;;
*) echo "Unknown state"
*) echo "Unknown state" >> keepalived.info
exit 1
;;
esac