Forum Discussion
Charles_Harris
Mar 16, 2006Nimbostratus
Ok, a blatent interest request......
Here's what I've come up with to solve our minimum members requirement, I've got no idea how a health monitor should be written, so this is dirty but very fast....
Please advise, comment or ridicule as you see fit ;-D
Cheers,
-=ChaZ=-
Can't attach so here it is:
!/bin/bash
Pool & Member Definitions: Hardcoded for speed
POOL=3.5_XXX_Pool
POOL_PORT="29XXX"
POOL_MEMBERS="\
1XX.XXX.XXX.XXX:$POOL_PORT \
2XX.XXX.XXX.XXX:$POOL_PORT \
1XX.XXX.XXX.XXX:$POOL_PORT"
POOL_MAXIMUM_NUMBER_OF_DISABLED_MEMBERS=2
POOL_TOTAL_NUMBER_OF_MEMBERS=3
BP cmd: **ONLY** needs to see DISABLED in any of the output of a status of bp
and INACTIVE,FORCED
POOL_STATUS_CMD=`bp pool $POOL show`
ARRAYDNT=0
ARRAYFNT=0
for BP_OUTPUT in $POOL_STATUS_CMD
do
if [ "$BP_OUTPUT" = "DISABLED" ]
then
(( ARRAYDNT += 1 ))
elif [ "$BP_OUTPUT" = "INACTIVE,FORCED" ]
then
(( ARRAYFNT += 1 ))
fi
done
[[ $ARRAYDNT = 0 ]] && echo "up" && exit NOTHING TO DO? Leave BigIP alone.
[[ $ARRAYFNT = $POOL_TOTAL_NUMBER_OF_MEMBERS ]] && echo "down" && exit NOTHING TO DO? Leave BigIP alone.
If a member is disabled, check for the minimum required and down if not met
if [ $ARRAYDNT -ge $POOL_MAXIMUM_NUMBER_OF_DISABLED_MEMBERS ]
then
for DISABLE in $POOL_MEMBERS
do
bp pool $POOL member $DISABLE down
done
echo "down"
else
echo "up"
fi
exit