Forum Discussion
computer_41235
Nimbostratus
Aug 01, 2013F5 outside flow Bandwidth control
Hi experts,
I have one question on the link environment deployment.
1. Environment Description
F5 works as the link access device in the edge of the data center. There are...
computer_41235
Nimbostratus
Aug 03, 2013The following equipment is used in test A10 script link switch code, I would like to ask that we do OUTSIDE traffic switching F5 how to write such a script , LC OR GTM only do INBOUND traffic
But I want to achieve OUTSIDE traffic link switching
check-gzct2 30 3 30 1 EXTERNAL 1
External script checkvlan used by monitor check-gzct2
!!! Content Begin !!!
!/bin/sh
axAPI()
{
groupname=$1
linkIP=$2
action=$3
toweight=$4
priority=$5
mysession=`curl -s -d "method=authenticate&username=axapi&password=a10axapi" http://127.0.0.1/services/rest/V1/ | awk -F \> '{print $4}' | awk -F \< '{print $1} '`
case $action in
"1") a=`curl -s -d "session_id=$mysession&method=slb.server.update&address=$linkIP&weight=$toweight" http://127.0.0.1/services/rest/V1/`;;
"2") a=`curl -s -d "session_id=$mysession&method=slb.service-group.update&name=$1&member-list=member1&member1=address%03$linkIP%02port%030%02priority%03$priority" http://127.0.0.1/services/rest/V1/`;;
esac
c=`curl -s "http://127.0.0.1/services/rest/V1/?method=session.close&session_id=$mysession"`
}
toasc() {
i=1
server=$1
printf ${server}
printf "."
while (( i <= ${server} ))
do
char=$(expr substr "$server" $i 1)
printf "%d" \'"$char"
(( i += 1 ))
if [ $i -le ${server} ]; then
printf "."
fi
done
}
total=`expr $3 / 10 `
threshold=`expr $4 / 10 `
count=1
if [ -f $2_count ]; then
count=`cat $2_count | awk ' { print \$1 } '`
fi
if test $count -le 1 ; then
oid=".1.3.6.1.4.1.22610.2.4.3.2.2.2.1.6."
server="$(toasc "$2")"
portusage=`snmpget -v 2c -c a10snmp 127.0.0.1 $oid$server | awk ' { print $4} '`
t=`date`
echo "$t: Jian Test $2: usage is $portusage "
oldpu=$portusage
if [ -f $2_pu ]; then
oldpu=`cat $2_pu | awk ' { print \$1 } '`
fi
echo $portusage >$2_pu
realpu=`expr $portusage - $oldpu `
used=`expr $realpu \* 8 / 10000000 / 120 `
weight=`expr $total - $used`
echo "$t: Jian Test $2: real weight is $weight"
if test $weight -lt 1 ; then
weight=1
fi
if test $used -ge $threshold; then
weight=1
fi
echo "$t: Jian Test $2: weight is $weight"
axAPI link $2 1 $weight
fi
if test $count -ge 4 ; then
count=0
fi
countupdate=`expr $count + 1 `
echo $countupdate > $2_count
Test_IP=("222.68.185.229" "211.95.72.229" "58.248.42.181" "211.94.128.24" "219.141.157.30" "220.181.6.175" "61.135.169.105" "58.242.1.187" "202.102.194.50" "202.103.124.34" )
i=0
while [ $i -le 9 ]
do
route del -host ${Test_IP[$i]} gw $2
route add -host ${Test_IP[$i]} gw $2
ret=$?
if test $ret -gt 0; then
exit 1
fi
curl --max-time 1 --interface $1 ${Test_IP[$i]} > /dev/null 2>&1
ret=$?
route del -host ${Test_IP[$i]} gw $2
t=`date`
if test $ret == 0 ; then
echo "$t Testing $2-$i: ${Test_IP[$i]} OK"
echo "$t $2 Passed"
exit 0
else
echo "$t Testing $2-$i: ${Test_IP[$i]} Fail"
fi
i=`expr $i + 1`
done
echo "$t $2 Failed"
exit 1
!!! Content End !!!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects