18 lines
848 B
Bash
18 lines
848 B
Bash
|
|
#!/bin/bash
|
||
|
|
# Timestamped liveness log for the Management VLAN during the bond0 -> bond0.1 move.
|
||
|
|
#
|
||
|
|
# The question this answers is not "did it work" but "for how long was it not
|
||
|
|
# working, and what held the VIP while it was not". Both are invisible after the
|
||
|
|
# fact: VRRP reconverges and leaves no trace of who was master during the gap.
|
||
|
|
#
|
||
|
|
# ./vlan1-move-monitor.sh > /tmp/move.log &
|
||
|
|
# Columns: time VIP-ping R1-ping R2-ping VIP-mac
|
||
|
|
VIP="${VIP:-172.31.1.1}"; R1="${R1:-172.31.1.252}"; R2="${R2:-172.31.1.253}"
|
||
|
|
p() { ping -c1 -W1 -n "$1" >/dev/null 2>&1 && echo up || echo DOWN; }
|
||
|
|
while :; do
|
||
|
|
mac="$(ip neigh show "$VIP" 2>/dev/null | awk '{for(i=1;i<=NF;i++) if($i=="lladdr") print $(i+1)}')"
|
||
|
|
printf '%s vip=%-4s r1=%-4s r2=%-4s vipmac=%s\n' \
|
||
|
|
"$(date +%H:%M:%S)" "$(p "$VIP")" "$(p "$R1")" "$(p "$R2")" "${mac:-none}"
|
||
|
|
sleep 1
|
||
|
|
done
|