Forum Discussion

Dbow_21284's avatar
Dbow_21284
Icon for Nimbostratus rankNimbostratus
Aug 18, 2009

Help with External HTTP Monitor (cURL) - Requires http authentication

Hello,

 

I am taking a variation of an external monitor used when NTLM auth is required and tweaking it for jsut regular http authentication. However, I am having an issue getting it to work entirely. When I run the external monitor from an SSH CLI (for instance, sh -x /usr/bin/monitors/AUTH_Members 10.10.185.40 80 ) I get the appropriate response, but when I apply the monitor to a pool in the MGMT GUI, it does not work.

 

 

My External monitor code is below and is testing return string of "1-UP":

 

  
 !/bin/sh  
  remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format)  
 IP=`echo ${1} | sed 's/::ffff://'`  
  IP=${1}  
 PORT=${2}  
 PIDFILE="/var/run/`basename ${0}`.${IP}_${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  
  send request & check for expected response  
 curl -L -v --user 'testuser:superpassword' http://${IP}:${PORT}/_layouts/ACCApplications/CommonLogin/login.aspx?ReturnUrl=%2fwhatsup.aspx -H "Host: members.acc.org" | grep -i "1-UP"   
 2>&1 > /dev/null  
  mark node UP if expected response was received  
 if [ $? -eq 0 ]  
 then  
 echo "UP"  
 fi  
 rm -f $PIDFILE  
 exit  
 

 

 

When I execute it in the CLI with command, sh -x /usr/bin/monitors/AUTH_Members 10.10.185.40 80, it seems to work! See below:

 

  
 [admin@dmzlb1:Active] monitors  sh -x /usr/bin/monitors/AUTH_Members 10.10.185.40 80  
 ++ echo 10.10.185.40  
 ++ sed s/::ffff://  
 + IP=10.10.185.40  
 + PORT=80  
 ++ basename /usr/bin/monitors/AUTH_Members  
 + PIDFILE=/var/run/AUTH_Members.10.10.185.40_80.pid  
 + '[' -f /var/run/AUTH_Members.10.10.185.40_80.pid ']'  
 + echo 9294  
 + curl -L -v --user testuser:superpassword 'http://10.10.185.40:80/_layouts/ACCApplications/CommonLogin/login.aspx?ReturnUrl=%2fwhatsup.aspx' -H 'Host: members.acc.org'  
 * About to connect() to 10.10.185.40 port 80  
 *   Trying 10.10.185.40... + grep -i 1-UP  
 connected  
 * Connected to 10.10.185.40 (10.10.185.40) port 80  
 * Server auth using Basic with user 'testuser'  
 > GET /_layouts/ACCApplications/CommonLogin/login.aspx?ReturnUrl=%2fwhatsup.aspx HTTP/1.1  
 > Authorization: Basic ZGRlbmJvdzpiYWJ5cmVuMQ==  
 > User-Agent: curl/7.15.3 (i686-redhat-linux-gnu) libcurl/7.15.3 OpenSSL/0.9.7l zlib/1.1.4  
 > Accept: */*  
 > Host: members.acc.org  
 >  
 < HTTP/1.1 200 OK  
 < Date: Tue, 18 Aug 2009 21:05:43 GMT  
 < Server: Microsoft-IIS/6.0  
 < X-Powered-By: ASP.NET  
 < MicrosoftSharePointTeamServices: 12.0.0.6510  
 < X-AspNet-Version: 2.0.50727  
 < Cache-Control: private  
 < Content-Type: text/html; charset=utf-8  
 < Content-Length: 21385  
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
 Dload  Upload   Total   Spent    Left  Speed  
 100 21385  100 21385    0     0   940k      0 --:--:-- --:--:-- --:--:-- 4579k* Connection 0 to host 10.10.185.40 left intact  
 * Closing connection 0  
 + '[' 0 -eq 0 ']'  
 + echo UP  
 UP  
 + rm -f /var/run/AUTH_Members.10.10.185.40_80.pid  
 + exit  
 

 

 

Has anyone ever seen this or experienced this? Or any ideas where to go on this? I have verified the member IP addresses in the pool are right. So unfortunately, its not something simple like this.

 

 

Also, I tried a stock HTTP monitor via the GUI with the following configuration which didnt work either, which is why I went to the external monitor:

 

 
 GET /_layouts/ACCApplications/CommonLogin/login.aspx?ReturnUrl=%2fwhatsup.aspx HTTP/1.1\nHost: members.acc.org \nConnection: close\n\n

 

Then I put the username and password in their respective fields in the properties of the monitor in the LTM GUI. That didnt work either.

 

 

Thanks,

 

Dbow

11 Replies