Forum Discussion
Interface Failsafe Script
Dears,
I am currently using an external Interface Failsafe script to monitor Data Trunk on F5 Viprion 10.2.4 platform this Trunk is connected to the core switch in our 3G network, i have find out that there is no output coming from b interface show command which caused the script to consider that the trunk is down which is not the fact, there for I faced a toggle action with no logic reason, i have no idea why is that , CAN I FIND ANY HELP ?
!/bin/bash
(c) Copyright 2007 F5 Networks, Inc.
Kirk Bauer
Pass in each interface to monitor via the Arguments field in the GUI.
Each interface may be one of the following:
Physical interface (1.1, 1.2, etc)
Name of a trunk (if at least one interface is up the trunk is considered up)
trunk=min where trunk is the name of the trunk and min is the minimum number
of physical interfaces in the trunk that must be up
For example, the following arguments will make sure that the 1.1 interface is
up and test_trunk has at least two interfaces in it that are up:
1.1 test_trunk=2
To test on command-line, use fillers for first two arguments:
/usr/bin/monitors/interface_monitor.sh X X 1.1 1.2 1.3 ...
Collect arguments (first remove IP and port as we don't use those)
shift
shift
interfaces="$*"
b interface show > /tmp/b_interface_show
for i in $interfaces ; do
if grep -q "^ *$i " /tmp/b_interface_show ; then
Physical Interface
status=`grep "^ *$i " /tmp/b_interface_show | awk '{print $2}'`
if [ "$status" != "UP" ] ; then
logger -p local0.notice "$MON_TMPL_NAME: interface $i is not up (status: $status)"
exit 1
fi
else
Not a physical interface, assume a trunked interface
trunk="$i"
reqcount=1
if echo "$trunk" | grep -q '=' ; then
trunk="$(echo "$i" | sed 's/=.*//')"
reqcount="$(echo "$i" | sed 's/^.*=//')"
fi
upcount=0
for status in `grep "$trunk" /tmp/b_interface_show | awk '{print $2}'` ; do
[ "$status" == "UP" ] && upcount=$[$upcount+1]
done
if [ $upcount -lt $reqcount ] ; then
logger -p local0.notice "$MON_TMPL_NAME: trunk $trunk is down (has only $upcount active interfaces, $reqcount required)"
cp /tmp/b_interface_show /var/tmp/b_interface_show_`date +%H.%M.%S`
exit 1
fi
fi
done
All specified interfaces are up...
echo "up"
exit 0
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com