The script you provided above is based on server side configuration. I do not think we will be able to control from the ADC perspective. We have another solution to your requirements and its called “SNMP-based load balancing”. This feature is available in 2.7.1 and above which offers the ability to query CPU utilization or memory utilization and dynamically set the weight values of the servers.
Here is an example of a Shell script for SNMP-based load balancing. This script uses the results from queries to the UC-SNMP-MIB MIB module.
#!/bin/sh
dst=“$HM_SRV_IPADDR”
#dst=“$HM_SRV_IPADDR:$HM_SRV_PORT”
Community String
community=“public”
UC-SNMP-MIB::extResult.1
oid=“.1.3.6.1.4.1.2021.8.1.100.1” (Note: This has to be updated based on server OID information)
function check_value {
echo “$output”
value=echo $output | sed 's/INTEGER: //'
echo “value” = “$value”
if [[ “$value” =~ “[1]*$” ]]; then
echo “digit string”
if [ $value -ge 0 -a $value -lt 125 ]; then
echo “Good”
exit $value
fi
fi
}
echo “/usr/bin/snmpget -v2c -c "$community" -Ov "$dst" $oid”
output=$(/usr/bin/snmpget -v2c -c “$community” -Ov “$dst” $oid)
if [ 0 != $? ]; then
exit -1
fi
check_value
success
echo “Mark server down”
exit -1
[:digit:] ↩︎