Mangretta
May 15, 2024Nimbostratus
monitor a pool that consists of Linux Squid Servers
I am trying to monitor a pool that consists of Linux Squid Servers. The issue I am having is when a squid servers service stops processing requests and the port 3128 is sgtill responding,
the pool members do not go down. The squid server then starts to generate timeouts to the client.
We have created a custom script/external monitor that does a CURL to a paticular destination while expecting a specific return string. We used the following KB artical to
attempt to monitor them (https://my.f5.com/manage/s/article/K31435017). The issue is, When we apply the External monitor to the pool, it has no way of accepting the UP or DOWN status that is being returned
by the script.
How do I tell the F5 to expect a receive string and remove the node from the pool using this external monitor.
Script:
# 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 pid
if [ -f $PIDFILE ]
then
echo "EAV exceeded runtime needed to kill ${IP}:${PORT}" | logger -p local0.error
kill -9 `cat $PIDFILE` > /dev/null 2>&1
fi
echo "$$" > $PIDFILE
# send request & check for expected response
website="https://mywebsite.com"
timeout_seconds=5
response_code=$(curl --write-out "%{http_code}" --silent --output /dev/null --max-time $timeout_seconds $website)
if [ "$response_code" == "200" ];
then
rm -f $PIDFILE
echo "UP"
else
rm -f $PIDFILE
# echo "DOWN"
fi
exit