Forum Discussion

CraigM_17826's avatar
CraigM_17826
Icon for Altostratus rankAltostratus
Mar 16, 2010

External Monitor not working

Hi all,

I am having some odd issues with a monitor. I have a web application I need to monitor and for whatever reason a HTPS monitor does not seem to work. The status of the pool always stays as "Unknown (Enabled)"

In desperation I am now trying to use a external monitor. Using the sample_monitor.sh script in /usr/bin/monitors as a basis for my monitor. The script uses three arguments, hostname/ip, URI and expected string. If the output of curl contains the extected string then it returns UP, else it returns DOWN.

Now the script runs and works as expected when I execute it from the command line, but when I create a external monitor to run this script with the required parameters the status of the pool remains as "Unknown". I decided to put in a debug line in the script that creates a logfile and writes to the logfile at certain points within the script. This logfile is never created which seems to inidicate the monitor is not being run.

Any ideas on why this would be the case? All I see is this in the LTM logfile once I apply the monitor to my test pool

Mar 16 15:59:12 local/bigip-u1 notice mcpd[1657]: 01070638:5: Pool member nnn.nnn.nnn.nnn:443 monitor status unchecked.

Here is the monitor shell script

   
   !/bin/sh   
      
   LOGFN="/tmp/exam-services.log"   
   touch $LOGFN   
   echo "Starting exam-services monitor" >>$LOGFN   
      
    remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format)   
   IP=`echo ${1} | sed 's/::ffff://'`   
      
   PIDFILE="/var/run/`basename ${0}`.${IP}.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   
   echo "PIDFILE $PIDFILE created" >>$LOGFN   
      
    send request & check for expected response   
    using -k as Monash use a self signed certificate   
      
      
   echo "Executing CURL command" >>$LOGFN   
   curl -fNsvk https://${IP}/exam-services/student 2>&1 | grep -i "/exam-services" 2>&1 > /dev/null   
    mark node UP if expected response was received   
   if [ $? -eq 0 ]   
   then   
       echo "UP"   
       echo "Exam Services Website is up." >>$LOGFN   
   else   
       echo "DOWN"   
       echo "Exam Servicews Website is down." >>$LOGFN   
   fi   
      
   rm -f $PIDFILE   
   echo "Exiting exam-services monitor" >>$LOGFN   
   exit   
   

and in the health monitor GUI setup screen I have

External Program: /usr/bin/monitors/examservices_monitor.sh

Arguments:

I have actually tried just specifying the scipt name unqualified in the External Program field as well and there was no difference.

Everything else is left at their default values.

As I mentioned, it all works when I run from the command line.

Regards

Craig

p.s. Sorry, omitted to mention we are running 10.0.1 Build 378.0 with HF3.

20 Replies