Forum Discussion
Deb_Allen_18
Jan 15, 2008Historic F5 Account
My original script is correct in that I need it to run a for loop
for i in `seq 1 2`; do
curl -fNs -m ${P_TIMEOUT} http://w50-$i.c50.domain.com:${CAUCHOPORT}${URI} | grep -io "w50-$i"'.c50.domain.com:6802 .ok.' 2>&1 > /dev/null
As I mentioned before, this approach may work fine for a standalone script intended to monitor multiple hosts, but that is not what you are trying to build here. What you need is an LTM monitor, and an LTM monitor script is really a template for monitoring a single pool member. Whether you apply an LTM monitor to an individual pool member or to the entire pool in the GUI, a separate copy of the monitor runs for each pool member, passing only that specific IP & port to be tested and maintaining only that single tested pool member's availability.
Since the provided monitor script returns the expected value when run from the command line, the next step is to apply it as an external monitor using the settings recommended previously, and look at a trace of the monitor traffic to see what's going wrong.
Your tcpdump command should include the interface name before the host IP & port:
tcpdump -nni internal host 10.50.0.246 and port 4000
There is a logical problem you're bound to encounter once you get the monitor working, though: Since all pool members' status will be reflected in the output of this script, and the wildcard expression in the current RECV string will match all instances of the reported status, each pool member will be marked UP if any of them are UP (IOW, you will only ever get a DOWN status using this script against this page if all servers are DOWN.)
To work around that, you'll need to make your RECV string something more specific per instance. Since the last octet of the IP address is the same as the host number value you need, you should be able to use this string as the new RECV string to substitute that value on the fly for each monitor instance:
w50-`echo $IP | cut -d. -f4`.c50.domain.com:6802 .ok.
Be sure to test the script itself at the command line as you did before to verify the intended functionality before defining it as an external monitor./deb