Skip to content

Instantly share code, notes, and snippets.

@jnikolak
Last active July 15, 2017 02:09
Show Gist options
  • Save jnikolak/dd97f0f15484885171e348b0f6c3c5de to your computer and use it in GitHub Desktop.
Save jnikolak/dd97f0f15484885171e348b0f6c3c5de to your computer and use it in GitHub Desktop.
Failover Monitoring
#!/bin/bash
filename=/tmp/$(hostname -f).out
rm -f $filename
journalctl --since "now" -f >> $filename&
#for ((n=0;n<5;n++))
echo "Script is running, press \"cntrl c\" to stop"
while true
do
echo -e "$(date +%T)" >> $filename
#not needed because we get this from proc/net/bonding grep "" /sys/class/net/bond0/bonding/* >> $filename
echo -e "\n" >> $filename
ip route get 10.0.0.254 >> $filename
if [ -d /proc/net/bonding/bond0 ];then
cat /proc/net/bonding/bond0 >> $filename
for i in bond0 enp7s0 enp6s0;do ip a show $i >> $filename;done
else
teamdctl team0 state >> $filename
for i in team0 enp7s0 enp6s0;do ip a show $i >> $filename;done
fi
ip neigh >> $filename
ping -c5 -i .5 10.0.0.254 >> $filename
# echo -e "\n" >> $filename
echo -e "\n############################################################################################\n\n" >> $filename
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment