Forum Discussion
The_Bhattman
Feb 17, 2010Nimbostratus
Hi Jon,
The one thing you can't do is run unix commands through an iRule. However, what you asked can be possible triggered by a custom monitor. The custom script woud monitor the Active Pool members and upon discovering it's unavailable it would log into the remote APP server and run a command and once that is done it would would then officially report back the system is down thereby informing the GTM to fail over.
For example let's say the the GTM is monitoring a vip connected to a pool on the LTM in active site and monitoring a vip on site B (Passive). The LTM is using a custom monitor to check say DNS on the pool members
The script would look something like the following:
!/bin/sh
these arguments supplied automatically for all external monitors:
$1 = IP (nnn.nnn.nnn.nnn notation or hostname)
$2 = port (decimal, host byte order) -- not used in this monitor, assumes default port 53
$3 = name to be looked up
$4 = string in expected response
node_ip=`echo $1 | sed 's/::ffff://'`
pidfile="/var/run/`basename $0`.$node_ip..$2.pid"
if [ -f $pidfile ]
then
kill -9 `cat $pidfile` > /dev/null 2>&1
fi
echo "$$" > $pidfile
dig @${node_ip} ${3} | egrep -v '^$|^;' | grep ${4} > /dev/null 2>&1
For AAAA lookups, use this instead
dig @${node_ip} ${3} AAAA| egrep -v '^$|^;' | grep ${4} > /dev/null 2>&1
status=$?
if [ $status -eq 0 ]
then
echo "UP"
else
here is the code that would remotely log in and execute the unix command
fi
rm -f $pidfile
What would happen is that if the script failed it would first run the remote command before reporting back to the GTM to fail over to the standby system
Of course this is all theory so you are definitely going to need to test it
I hope this helps
Bhattman