cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

External Health monitor scripts

Heleno_Vicente
Nimbostratus
Nimbostratus

Hello DevCentral Friends: Im having an issue with external monitor scripts, and i wonder if any of you can help. Im trying to create a script to monitor my service at application layer. In BIG IP LTM i add the following info to my external monitor:

>ltm monitor external eav_test_monitor {

  defaults-from external

  destination *:*

  interval 5

  run /Common/Trails

  time-until-up 0

  timeout 16

 user-defined HOST sitefoint.net

 user-defined URI /v/1/siteservice.svc

user-defined RECV siteService Service

}

 

>I have around 40 different services (Pools name) all using the the same back-end Server IPs (10.X.X.60, 10.X.X.61 and 10.X.X.62). when applied my ext-monitor to siteinfo.net service, it is also shown on other services (all 40 instances)..

 

>The attached scripts is applied to the ext monitor in BIG-IP. But when the ext health monitors is applied the pool it doesn't work. The Pool goes Down. Logs shows eav failed. Services down due to ext monitor.

 

Any idea what is wrong on the scripts below, or what might be the problem? I have tried with no recv string set as well...

 

#!/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: 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)

# HOST = the host name of the SNI-enabled site

 

#

# remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format)

 

#IP=`echo ${1} | sed 's/::ffff://'`

NODE=`echo ${1} | sed 's/::ffff://'`

if [[ $NODE =~ ^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then

NODE=${NODE}

else

NODE=[${NODE}]

fi

 

PORT=${2}

PIDFILE="/var/run/`basename ${0}`.${HOST}_${PORT}_${NODE}.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 ${HOST}_${PORT}_${NODE}" | logger -p local0.error

  kill -9 `cat $PIDFILE` > /dev/null 2>&1

fi

echo "$$" > $PIDFILE

 

# send request & check for expected response

#curl -fNsk https://${IP}:${PORT}${URI} | grep -i "${RECV}" 2>&1 > /dev/null

curl -fNsk --resolve $HOST:$PORT:$NODE https://$HOST$URI | grep -i "${RECV}" > /dev/null 2>&1

 

# mark node UP if expected response was received

if [ $? -eq 0 ]

then

  rm -f $PIDFILE

  echo "UP"

else

  rm -f $PIDFILE

fi

exit

 

 

 

0 REPLIES 0