Forum Discussion
Issue with "HTTP Monitor cURL Probe Timeout" - and question about timeout options
Hello -
This is a 2-part question/issue regarding the "HTTP Monitor cURL Probe Timeout" monitor outline here: https://devcentral.f5.com/wiki/advd...meout.ashx
The first issue is that my nodes are always being marked up regardless of what I have defined in the "RECV" variable. As a test - I defined the variable with the text string "thisshouldfail" - and the nodes continue to stay online.
Second - I need to be able to specify the timeout value (P_TIMEOUT) in milliseconds - but the standard curl "-m" command will only accept seconds. Are there any modifications I can make to this method that would allow me to specify that value in milliseconds? Our application is extremely sensitive to timeouts - so I need to set that to something around 150-200 ms.
The actual configuration and "external monitor file" I'm using are below. Note that I had to modify the curl request from the original file to add the Host header value in order for the request to work with our servers (--header "Host:example.companyname.com"). I have also substituted some of the values in the URI string to protect company data.
Any advice or suggestions would be greatly appriciated! :-)
Thanks!
==================================================================
ltm monitor external /Common/AdServe_curl_timeout_v2 {
defaults-from /Common/external
destination *:*
interval 5
run /Common/http_probe_with_timeout
time-until-up 0
timeout 16
user-defined POOL server_pool1
user-defined P_TIMEOUT 2
user-defined RECV thisshouldfail
user-defined URI /hic/\?arg1=something&arg2=300&arg3=250&arg4=160&arg5=soemthingelse&arg6=string5&nb&passback&random
}
==================================================================
!/bin/sh
(c) Copyright 1996-2007 F5 Networks, Inc.
This software is confidential and may contain trade secrets that are the
property of F5 Networks, Inc. No part of the software may be disclosed
to other parties without the express written consent of F5 Networks, Inc.
It is against the law to copy the software. No part of the software may
be reproduced, transmitted, or distributed in any form or by any means,
electronic or mechanical, including photocopying, recording, or information
storage and retrieval systems, for any purpose without the express written
permission of F5 Networks, Inc. Our services are only available for legal
users of the program, for instance in the event that we extend our services
by offering the updating of files via the Internet.
@() $Id: HTTPMonitor_cURL_ProbeTimeout,v 1.0 2007/09/20 13:09:07 deb Exp $
(based on sample_monitor,v 1.3 2005/02/04 18:47:17 saxon)
these arguments supplied automatically for all external monitors:
$1 = IP (nnn.nnn.nnn.nnn notation)
$2 = port (decimal, host byte order)
additional command line arguments ($3 and higher) may be specified in the monitor template
(This example does not expect any additional command line arguments)
Name/Value pairs may also be specified in the monitor template
This example expects the following Name/Vaule pairs:
P_TIMEOUT = the probe timeout value -- max time for app to respond to be marked UP
POOL = the name of the pool containing the members monitored by this monitor instance
URI = the URI to request from the server
RECV = the expected response (not case sensitive)
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} --header "Host:example.companyname.com" http://${IP}:${PORT}${URI} | grep -i "${RECV}" 2>&1 > /dev/null
if expected response was received, force the node UP if it was previously
FORCEDOWN, & output something to stdout so bigd continues to mark the node UP
if [ $? -eq 0 ]
then
/bin/bigpipe pool myPool member 10.10.10.100:8080 show | grep "forced down" 2>&1 > /dev/null
if [ $? -eq 0 ]
then
/bin/bigpipe pool ${POOL} member ${IP}:${PORT} up 2>&1 > /dev/null
fi
rm -f $PIDFILE
echo "UP"
if expected response is not received in time, force the node DOWN immediately
else
/bin/bigpipe pool ${POOL} member ${IP}:${PORT} down 2>&1 > /dev/null
rm -f $PIDFILE
exit
fi
3 Replies
- uni
Altocumulus
I suspect your problem with the monitor always being up is that you are running this on a v11 platform, but your shell script is referencing the bigpipe command. This script would need a few modifications to work in v11+
As for sub-second timeout resolution, you can't do that with the command-line version of curl, but libcurl does support it. To use libcurl, you would need to write your external monitor in another scripting language such as perl. You can then use the CURLOPT_CONNECTTIMEOUT_MS option.
- David_Murphy_20
Nimbostratus
What would I need to use in place of the "bigpipe" command - and what other modifications would need to be made for this to work in v11.4.0?
Thanks!
You would need to use tmsh, which has slightly different output so your grep statements may also need to be modified.
Example tmsh: /usr/bin/tmsh show ltm pool myPool member 10.10.10.10:8080
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