Forum Discussion
JG
May 03, 2017Cumulonimbus
You could do this with an external monitor, such as below:
!/bin/sh
these arguments supplied automatically for all external pingers:
$1 = IP (::ffff:nnn.nnn.nnn.nnn notation or hostname)
$2 = port (decimal, host byte order)
$3 and higher = additional arguments
$MONITOR_NAME = name of the monitor
In this sample script, $3 is the regular expression
Name of the pidfile
pidfile="/var/run/$MONITOR_NAME.$1..$2.pid"
Send signal to the process group to kill our former self and any children
as external monitors are run with SIGHUP blocked
if [ -f $pidfile ]
then
kill -9 -`cat $pidfile` > /dev/null 2>&1
fi
echo "$$" > $pidfile
Remove the IPv6/IPv4 compatibility prefix
node_ip=`echo $1 | sed 's/::ffff://'`
Using the nc utility to get data from the server.
Search the data received for the expected expression.
echo "GET /" | /usr/bin/nc $node_ip $2 2> /dev/null | grep -E -i $3 > /dev/null
echo -e "GET http://appname.companyname.com/authentication.GetServerstatus/appname HTTP/1.0\n\n" | /usr/bin/nc -s ext.ip.addr.on.f5 appname.companyname.com 80 | grep "my expected return string" > /dev/null 2>&1
status=$?
if [ $status -eq 0 ]
then
Remove the pidfile before the script echoes anything to stdout and is killed by bigd
rm -f $pidfile
echo "up"
fi
Remove the pidfile before the script ends
rm -f $pidfile
[Untested].
Replace "ext.ip.addr.on.f5" with a public IP address on your F5 system.