Forum Discussion
monitor a pool that consists of Linux Squid Servers
As per the original script you mentioned, the receive string must be tested using the script and not from the GUI config (RECV = the expected response).
"if [ $? -eq 0 ]" checks if the last command was executed without errors, which seems to be always the case with your command.
Additionally, whatever your script send to the standard output (wether UP or Down or Simpsons...) it will cause the member to be marked up. For a member to be marked Down the script should output nothing.
So, to summarize, you must test for the receive string within your script, and you must not send data to standard output if the pool member has to be marked down.
More on external monitors here: Overview of BIG-IP EAV external monitors (f5.com)
- MangrettaNimbostratus
Ok. I have adjusted the code and have proven that I am indeed receiving a 0 back but the pool does not come up. Does anyone have any experience with this? I am using the F5 KB article mentioned with no success.
Here is the updated script and output.
# start sample script#!/bin/sh# (c) Copyright 1996-2007 F5 Networks, Inc.## @(#) $Id: http_monitor_cURL+GET,v 1.0 2007/06/28 16:10:15 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 (IPv6 notation. IPv4 addresses are passed in the form# ::ffff:w.x.y.z# where "w.x.y.z" is the IPv4 address)# $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:# 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 pidif [ -f $PIDFILE ]thenecho "EAV exceeded runtime needed to kill ${IP}:${PORT}" | logger -p local0.errorkill -9 `cat $PIDFILE` > /dev/null 2>&1fiecho "$$" > $PIDFILE# send request & check for expected responsewebsite="https://mywebsite.com.com"timeout_seconds=5curl -x X.X.X.X:3128 --silent --output /dev/null --max-time $timeout_seconds $website#if [ "$response_code" == "302" ];if [ $? -eq 0 ]thenrm -f $PIDFILEecho "UP"elserm -f $PIDFILE# echo "DOWN"fiexitOutput from F5 command line:[admin@dc-pxy-rcp-f5a-inf-a1:Active:Changes Pending] / # curl -x X.X.X.X:3128 https://mywebsite.com
[admin@dc-pxy-rcp-f5a-inf-a1:Active:Changes Pending] / # echo $?
0
[admin@dc-pxy-rcp-f5a-inf-a1:Active:Changes Pending] / #
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