Dbow_21284
Jul 10, 2009Nimbostratus
Monitor HTTP Site needing NTLM to Test for Return String
I need to come up with a monitor for an HTTP site that requires NTLM authentication to access. Basically, our developers have a specific ASPX file I want to call and test a for a return string. The ASPX file does a database call and verifies some backend stuff for the site and returns a "1-UP" if its cool. This is what I need to verify I receive. If not, mark the node down. For instance, http://something.someone.org/something.aspx
Now I have looked at some code examples and other threads and it seems most call for using an external monitor using cURL. For instance, http://devcentral.f5.com/wiki/default.aspx/AdvDesignConfig/HTTPMonitor_cURL_GETWithHostSpecificHeaders.html
I have tried to get this to work but I think I am missing something and just not understanding the code at all. I set the variables for URI == /whatsup.aspx and RECV == 1-UP as the author states. I took out the "-k" too as its not HTTPS.
Can anyone provide a code example that would achieve what I am trying to do?
This is what I did:
!/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+HostSpecificHeaders,v 1.0 2007/06/28 15:03: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 (nnn.nnn.nnn.nnn notation)
$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)
PIDFILE="/var/run/`basename ${0}`.${NODE}_${PORT}.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
remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format)
NODE=`echo ${1} | sed 's/::ffff://'`
PORT=${2}
set the value for the Host header based on IP
(defaults to IP address if IP doesn't match)
case "$IP" in
"10.10.185.39")
HOST="intranet.acc.org"
;;
"10.10.185.40")
HOST="intranet.acc.org"
;;
*)
HOST="$IP"
;;
esac
send request & check for expected response
curl --ntlm -v -u 'DOMAIN\username:pswd' http://${NODE}:${PORT}${URI} -H "Host: ${HOST}" | grep -i "${RECV}" 2>&1 > /dev/null
mark node UP if expected response was received
if [ $? -eq 0 ]
then
echo "UP"
fi
rm -f $PIDFILE
exit
Thank you.
Dbow