Forum Discussion
Dbow_21284
Nimbostratus
Jul 10, 2009Monitor 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
- James_Quinby_46Historic F5 AccountWhat happens if you run the curl command by itself, from the CLI of your LTM? That is:
curl --ntlm -v -u 'DOMAIN\username:pswd' http://${NODE}:${PORT}${URI} -H "Host: ${HOST}"
- Dbow_21284
Nimbostratus
It just goes to an empty prompt ...weird! - James_Quinby_46Historic F5 AccountThe shell is waiting for the second pair of " marks. I don't think you need one after whatsup.aspx
- Dbow_21284
Nimbostratus
OK Duh .. thanks ... got this response below and I see the "1-UP" I am expecting. I get a 401 and 200 OK. - Dbow_21284
Nimbostratus
Any clues from above. It looks like it fails with the 401, then trieed another connection and gets a 200 OK. - hoolio
Cirrostratus
stp1978 posted a solution which worked for him to monitor a Sharepoint application: - Dbow_21284
Nimbostratus
YEs IActually referenced my code in my original post from that article. The thing I dont understand is what he is testing for.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects