Hi Emilhag,
For this requirement, you dont need to create an irule or sort... Just simply create a monitor as usual, but while creating the monitor, you would see the destination option.
In the destination, give your main pool member detail. So this means, the monitor assigned to the pool will look for this pool member status and mark the other members (including this member) status as Up or Down.
Example:
Members: 1.1.1.1:80, 1.1.1.2:80, 1.1.1.3:80, 1.1.1.4:80
create ltm monitor http interval 30 timeout 91 recv "Server Up" recv-disable "Server Drain" send "GET /your string" destination 1.1.1.1:80
So here 1.1.1.1:80 acts as the decider...
Hope this helps.
Edited: 19th Feb.
Hi Emilhag,
Sorry I misunderstood your requirement,
So if got your requirement correctly,
- You have 4 pool members.
- You want the VS to be marked down, even if one of the members goes down.
Here, you can try with an external monitor, where you define your own logic and ask the ltm to run commands to disable your virtual.
In the below external monitor, you'd see I have hardcoded 3 parameter,
pool=
your-poolname
minup=
4
virtual=
your-virtualname
So you have to update the below script according to your setup.
!/bin/sh
pidfile="/var/run/$MONITOR_NAME.$1..$2.pid"
Send signal to the process group to kill our former self and any children
as external monitors are run with SIGHUP blocked
if [ -f $pidfile ]
then
kill -9 -`cat $pidfile` > /dev/null 2>&1
fi
echo "$$" > $pidfile
pool=your-poolname
minup=4
virtual=your-virtualname
upmembers=`tmsh show /ltm pool $pool members |grep "Current Active Members" |awk -F" : " '{ print $2 }'`
if [ $upmembers -ge $minup ]
then
rm -f $pidfile
state=`tmsh show /ltm virtual $virtual |grep "State" |awk -F" : " '{ print $2 }'`
if [ $state == "disabled" ]
then
logger -p local0.info -t MONITOR-ALERT "Pool $pool Monitor UP - enabling virtual $virtual"
tmsh modify /ltm virtual $virtual enabled
fi
echo "up"
else
rm -f $pidfile
state=`tmsh show /ltm virtual $virtual |grep "State" |awk -F" : " '{ print $2 }'`
if [ $state == "enabled" ]
then
logger -p local0.info -t MONITOR-ALERT "Pool $pool Monitor DOWN - disabling virtual $virtual"
tmsh modify /ltm virtual $virtual disabled
fi
echo "up"
fi
Credits: Kevin Stewart from his original post.