New ISP installed and added to a load balance group. However the ISP has terrible letancy issues (satellite) and I would like that connection to be dropped from the group when the latency becomes too great. Wrote the following script
#!/bin/bash /bin/ping yahoo.com -c 3 2>/dev/null 1>/tmp/testout.log sed -i '1d' /tmp/testout.log sed -i '4,7d' /tmp/testout.log sed -i 's|^.*time=||' /tmp/testout.log sed -i 's|\ ms||' /tmp/testout.log sed -i 's|\..*||' /tmp/testout.log linetotal=0 while read line do linetotal=$(($linetotal + 1)) done < /tmp/testout.log SUM=0 while read line do SUM=$(($SUM + $line)) done < /tmp/testout.log final=$(($SUM / $linetotal)) if (("$final" > "900")); then exit 1 else exit 0 fi
and modified the load balance settings
interface eth0.3 { route-test { type { script /config/scripts/lbtest.sh } } weight 50 }
and the watchdog status shows
eth0.3 status: Running pings: 205 fails: 0 run fails: 0/3 route drops: 0 test script : /config/scripts/lbtest.sh - OK
I am assuming that the watchdog is looking for exit codes with the above givng code 1 for average response times greater than 900ms, making the test a failure and marking the connection as inactive. Is my assumption correct?