Forum Discussion
HTTPMonitor_cURL_ProbeTimeout
I cannot use the http monitor as the string I need to recieve is longer than 5120 bytes
The following script should work but I don't know how to implement it
PIDFILE="/var/run/`basename ${0}`.${NODE}_${PORT}.pid"
kill of the last instance of this monitor if hung and log current pid
if [ -f $PIDFILE ]
then
kill -9 `cat $PIDFILE` > /dev/null 2>&1
fi
echo "$$" > $PIDFILE
CAUCHOPORT=4000
POOL=cwmp.stage.443
URI=/caucho-status
P_TIMEOUT=5
send request & check for expected response
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
exstatus=$?
echo "exstatus = $exstatus"
let bigd mark node UP if expected response was received
otherwise force the node DOWN immediately
if [ $exstatus -eq 0 ]
then
echo bigpipe pool ${POOL} member 10.50.1.$i up 2>&1 > /dev/null
else
echo bigpipe pool ${POOL} member 10.50.1.$i down 2>&1 > /dev/null
fi
rm -f $PIDFILE
done
exit
27 Replies
- Deb_Allen_18Historic F5 AccountThe Adv Design & Config "ExternalMonitor" wiki page (Click here) has the implementation details you're looking for.
/deb - pgroven_71837
Nimbostratus
The directions say to put it in /config/eav but the F5 insists it be in /usr/bin/monitors
Once I put the script there
I added the following name/value variables in the GUI
CAUCHOPORT=4000
POOL=cwmp.stage.443
URI=/caucho-status
P_TIMEOUT=5
and the following argument
curl -fNs -m ${P_TIMEOUT} http://w50-$i.c50.2wire.com
I set the alias service port to 4000
I changed the script to match the F5 example here
then
echo "UP"
else
bigpipe pool ${POOL} member ${IP}:${PORT} down 2>&1 > /dev/null
fi
but it makes no difference
The members are shown as red and down
Not sure what I am dong wrong - Deb_Allen_18Historic F5 AccountOK, wiki page is updated to indicate the correct directory, sorry for the confusion there.
Now as far as your variables are concerned, you need either set them in the monitor definition as name/value pairs OR set them within the script. If you do both, your monitor settings will be ignored and the script values will be used for every instance of the script. In this case, since they are the same, that isn't the problem. (Also, if your pool members are defined on port 4000 already, you don't need to specify that as a variable value in either place.)
I'm not sure I understand your intention regarding the argument you've specified, but since your script doesn't look for any arguments (passed as $3 or greater), eliminate all arguments from the monitor definition.
LTM by default isn't configured for name resolution, and even if it were, resolving a name within a monitor is not recommended since the induced latency will most likely result in intermittent false down's.
You also have not included the required LTMv9 IP address parsing line. (This is the most likely reason your monitor is failing -- no valid destination address. I bet if you looked at a trace, you'd see no monitor traffic.)
I didn't notice reading your script before, but it seems to be using a for loop to check both pool members, and the loop is terminated in the wrong place for proper pidfile management. You are also using a bigpipe command to manipulate the node status. Neither approach represents how LTM monitors are intended to work, and both of them will interfere with the normal operation of the monitor.
Hold on & I'll post a script that will work and the monitor definition to deploy it...
/deb - Deb_Allen_18Historic F5 AccountOK...
Assuming your pool members are listening for monitor traffic on the same port as load balanced traffic, use this script:remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format) IP=`echo ${1} | sed 's/::ffff://'` PORT=${2} PIDFILE="/var/run/`basename ${0}`.${IP}_${PORT}.pid" kill of the last instance of this monitor if hung and log current pid if [ -f $PIDFILE ] then kill -9 `cat $PIDFILE` > /dev/null 2>&1 fi echo "$$" > $PIDFILE send request & check for expected response curl -fNs -m ${P_TIMEOUT} http://${IP}:${PORT}${URI} | grep -i "${RECV}" 2>&1 > /dev/null let bigd mark node UP if expected response was received otherwise force the node DOWN immediately if [ $? -eq 0 ] then echo "UP" else /bin/bigpipe pool ${POOL} member ${IP}:${PORT} down 2>&1 > /dev/null fi rm -f $PIDFILE exit
And configure your monitor with these variables:RECV=w50-[12].c50.domain.com:6802 .ok. POOL=cwmp.stage.443 URI=/caucho-status P_TIMEOUT=5
HTH
/deb - pgroven_71837
Nimbostratus
The script above did not work
I added CAUCHOPORT=4000 to the GUI template
and added
curl -fNs -m ${P_TIMEOUT} http://${IP}:${CAUCHOPORT}${URI} | grep -i "${RECV}" 2>&1 > /dev/null
but it still did not work
the reason being is that I need the F5 to check the resin status page at port 4000.
Resin handles the db connections on the back end.
Each app server hosts a page called resin status page (this page is only for monitoring)
This is located at IPADDRESS:4000/caucho-status
I need to grep each app servers resin status page for w50-1.c50.domain.com:6802 (ok) for app server 1
I need to grep the applicable page for w50-2c50.domain.com:6802 (ok) for app server 2
the pool cwmp.stage.443 actually sends traffic to port 5004 not 4000
but it still did not work
the pool cwmp.stage.443 actually sends to 5004
so when it downs the member traffice should not go to this port - Deb_Allen_18Historic F5 AccountThen you would want to use the supplied script and define the monitor template with the alias port of 4000, and it will pass it to the monitor as $2 / $PORT, rather than adding yet another variable with the same value.
/deb - pgroven_71837
Nimbostratus
Whether I put the 4000 in the GUI template or the script it still marks all servers as down.
I am not sure why
the script in my original post should work fine if the monitor can detect the UP per member - Deb_Allen_18Historic F5 AccountYour original script might work fine as a standalone, but if you are going to run it as a monitor, there are some special considerations you must take into account when coding. Review my first response for details.
If you could please post the bigip.conf sections for the virtual server, the pool, and the monitor definitions, I may be able to help further.
/deb - pgroven_71837
Nimbostratus
Attached is the monitor pool and virtual server configs
It does not matter if the monitor is applied to the pool cwmp.stage.443 or cwmp.stage.80
10.50.1.3 w50-3 and 10.50.1.4 w50-4 are offline for other reasons
}
monitor curlcaucho {
defaults from external
dest *:4000
POOL "cwmp.stage.443"
P_TIMEOUT "5"
RECV "w50-[12].c50.domain.com:6802 .ok."
run "curlcaucho"
URI "/caucho-status"
}
virtual cwmp.stage.443 {
destination 216.52.22.101:https
ip protocol tcp
profile cwmp.stage tcp
pool cwmp.stage.80
}
pool cwmp.stage.443 {
lb method member least conn
monitor all http and curlcaucho
member 10.50.1.1:5004
member 10.50.1.2:5004
member 10.50.1.3:5004
member 10.50.1.4:5004
}
sample html resin-status page to be parsed
resin-statusServer: w50-1.c50.domain.com
Config: /var/cms/conf/resin.conf
Server Start: Wed, 12 Dec 2007 14:28:23 -0800 (PST)
Server Reload: Wed, 12 Dec 2007 14:28:23 -0800 (PST)
Total Memory: 769.26Meg
Free Memory: 32.08Meg
TCP portsCurrent Threads Config
Protocolort Active Keepalive Total thread-max keepalive-max request-timeout
srun:6802 1 0 6 200 100 65
http:8080 1 0 3 200 100 65
Srun ServersHost Active Count live-time dead-time request-timeout
1. w50-1.c50.domain.com:6802 (ok) 0 15 15 30
2. w50-2.c50.domain.com:6802 (ok) 0 15 15 30
- Deb_Allen_18Historic F5 AccountThe script and monitor definition look fine, unless your servers are expecting an HTTPS request.
I see you have 2 monitors applied - the external monitor we've been discusssing + the default http monitor. I'd start by removing the default http monitor until I got the other working, then decide if it's even necessary.
If the external monitor by itself is still is marking the pool members down, you'll need to capture a packet trace from the server vlan, filtering on the LTM non-floating self-IP and port 4000, and look for monitor traffic from LTM to the servers & back.
HTH
/deb
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
