Forum Discussion
Shankar_Gandhi_
Nimbostratus
Mar 17, 2011Health Monitor to check content after logging in
I was wondering if there is a way to have a monitor for the pool members in way that, this health monitor needs to login and check the content of the poolmember URL and if the content matches after logging in then only the pool member needs te be placed in the pool, if the content doesn't matches then it should send out an email.. Thanks In Advance ---S.Shankar Gandhi
6 Replies
- George_Watkins_Historic F5 AccountHi Shankar,
It may be difficult to get a monitor to 'login'. I had a similar request in the past where I needed to monitor a page that is visible only after a user logs in. We were using a cookie to track users' sessions, so we just created a cookie that had an indefinite session length and built a custom HTTP monitor to provide this cookie. The monitor send string would look something like this:GET /somepage.php HTTP/1.1\r\nHost: mysite.example.com\r\nCookie: user_session_id=\r\nConnection: Close\r\n\r\n
That is assuming that your application is using cookies for user session persistence. If you're doing something else, you might have to get a bit more crafty.
On the email bit, I wouldn't use the LTM to send notifications. I'd look into Nagios, Opsview, Zabbix, etc. There are bunch of great monitoring solutions that do this very well.
Hope this helps,
George - Shankar_Gandhi_
Nimbostratus
Hi George,
Thanks for your quick reply..
Actually we have an application for this we have configured http health monitor and this looks for the content on the page and then places the pool member into load. Recently we had couple of issue with memory so the problem now is the login page looks good as how it should be, but after logging in it shows 404 page error. Will this cookie to tracker users help us!!
Thanks
S.Shankar Gandhi - George_Watkins_Historic F5 AccountHi Shankar,
This sounds like an application issue if you are getting a 404 after logging in. I'd sync up with your developers and get more information about how the login process works. Once they give you the full picture of how it occurs, it will be easier to write a monitor to examine the application.
The other option would be to have your developers write a monitor page that runs on the origin servers. The monitor page can examine the various elements within your application and report success or failure. Then you can just point your health monitor at this page.
-George - Shankar_Gandhi_
Nimbostratus
George-
It’s peoplesoft application and I can say any type of simple monitor which looks for some content after logging in should help us.. Can this be tried by using some sort of irule or any sort of health monitor!!
Thanks
S.Shankar Gandhi - Christopher_Boo
Cirrostratus
Dig around and you will find an example/thread of and external health monitor script that allows for logging in (plus some good info). I can't find the original, but here is a copy of the script I use to monitor sharepoint. The script type would be "external program".
!/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 /usr/bin/curl -L --ntlm -k -v --user 'user:password' http://ipaddress/pages/default.aspx -H "Host:99.99.99.99" | grep -i " World Medical" 2>&1 > /dev/null mark node UP if expected response was received if [ $? -eq 0 ] then echo "UP" fi rm -f $PIDFILE exit - Shankar_Gandhi_
Nimbostratus
This External monitor logs into the specified URL and checks for the content, If specified content matches then only the pool member will be placed in load if not it will be out of load.
After two weeks ups and downs ,I got an External monitor configured for one of our application .,I have followed below steps to get this done.
Step 1 :Logged into node under /config/monitors created a file with httpmonitor_curl_post and added below script
remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format)
NODE=`echo ${1} | sed 's/::ffff://'`
PORT=${2}
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
echo "EAV exceeded runtime needed to kill ${IP}:${PORT}" | logger -p local0.error
kill -9 `cat $PIDFILE` > /dev/null 2>&1
fi
echo "$$" > $PIDFILE
send request & check for expected response
curl -fNs http://${NODE}:${PORT}${URI} -d "${DATA}" | grep -i "${RECV}" 2>&1 > /dev/null
curl -fNs -i -L -H "Host: ${HOST}" "http://${NODE}:${PORT}${URI}" -b cookies.txt -d "${DATA}" | 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
Step 2: Logged into F5 GUI mode and created a external monitor with name http_Curl_post and under external monitor added the one which I created in step 1 ( httpmonitor_curl_post)
Step 3: Under Variables added
Host= hostname:port
URI=complete URL after .com
DATA= timezoneOffset=-330&userid=username&pwd=Password
RECV= Keyword which it need to check
Step 4 :Assign this external monitor to the pool.
I would like to say thanks Nobel & Nitass for helping on this.
http://www.thef5guy.com/blog/2010/08/sharepoint-2010-ntlm-and-big-ip-health-monitors/
http://ask.metafilter.com/18923/How-do-you-handle-authentication-via-cookie-with-CURL
Thanks
S.Shankar Gandhi
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
