HTTP health monitor using iRule

Hi

Need help to configure Health Monitor using iRule

- We have two web Servers in Active / Standby mode , running three websites on each server (on three seperate IP with IP Bindings) , our requirement is if any one of the website in a Pool goes down , all web sites should be shifted to other Pool.

Issue with normal HTTP health monitor is that it deosn’t detect the health monitor ( ASP page) configured for other website ( It should be because it deosn’t find path for the Virtual directory) , so the health monitor marks the site as down even if it is up. Is there any way to make it work with help of iRule or any ?? please refer me to the solution if already provide ( I am new to this group)

Thanks & regards

Welcome Prasad!

This one probably belongs over in the Management, Reporting and Logging area:

http://devcentral.f5.com/Community/TopicGroups/tabid/1082223/asg/44/showtab/groupforums/Default.aspx

That being said here are few areas you might want to check out..

Tips for health monitors:

http://devcentral.f5.com/wiki/default.aspx/AdvDesignConfig/ApplicationHealthMonitoring.html

Here is a good post for creating a simple health monitor:

http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/44/aft/61823/showtab/groupforums/Default.aspx

Check that area and post out. If you still run into an issue when trying to configure the monitor you might post a little more detail and provide the nitty gritty details of what your monitor needs to check, url path, timeouts on the monitor and stuff like that.

Hi Nathan,

Thanks for reply , I have gone through those link & posts but seems to be quite heavy for me ( at this stage at least :frowning: !!!. ) , My requirment is like this

We have two webserver with three websites.

IP SERVER site

x.x.x.1 WebSrv_1 www.abc.com ; www.123.com ; www.xyz.com ( Pool 1)

x.x.x.2 WebSrv_2 www.abc.com ; www.123.com ; www.xyz.com (Pool 2)

We have three health monitor abc.asp , 123.asp , xyz.asp , this health monitor prduces an output ( Receive string) depending on IIS & Database accordingly the pool becomes up and down.

Our requirement is any one of the website in a pool goes down , remaining 2 websites also should be marked down.

logic should be something like …if (abc & 123 & xyz ) are OK then WebSrv_1 else WebSrv_2

let me know if you need any further details

thanks

You can do things like checking the number of pool members available before sending traffic to the pool with an iRule, but I don’t think that you can check the availability of a downstream application status with an iRule.

The Pool can have numerous Health Checks applied to it and requirements on the number of health checks that must be successful in order to have the node marked up, but that would be an all or nothing.

I would suggest setting up a different pool and health check per site if you really want to be as accurate as possible.

Hi Michael,

Can you give samples of the iRule that you mentioned ?

I tried configuring multiple health checks on each pool , but it didn’t work.

Thanks

Nathan / Michael --- Any clues or examples ??

Thanks in Advance.

Regards,

Prasad.

Hi Prasad,

You could create three custom monitors that check your logic for abc.asp, 123.asp and xyz.asp. If you hardcode the destination port in the monitors and assign each of the monitors to both pool members and set the pool to require all monitors succeed, if any one monitor fails the pool member will be marked down.

If that’s not the exact logic you want, can you give example IP:ports and host header values for the different web apps and explain how you want the dependencies built?

Thanks, Aaron

Hi Aaron,

Thanks for the reply , I did exactly same thing for montoring , however it didn’t work , the issue I faced is the health monitor only work for that particular website i.e “abc.asp” works for “www.abc.com” only , remaining two monitors i.e 123.asp & xyz.asp marks the node as down even if it is up.

Monitors are as below

for “ABC” - get http://abc.com/include/abc.asp - receive string “abc”

for “123” - get http://123.com/123.asp - receive string “123”

for “xyz” - get .xyz Domain Names | Join Generation XYZ - receive string “xyz”

Now if I apply all three monitors for one wesbite ..say for abc.com - only “ABC” monitor works remaining two i.e 123 & xyz marks the node as down even if it is up , same is for other website.

Can you help ?

Thanks & regards,

Prasad.

If you have all three sites running on both nodes in the pool, then why wouldn’t all three monitors return true for both servers?

I think I’m a little bit confused by the requirements here. If you need to monitor 3 sites on each server, and all 3 are running on each server, then your above logic would work correctly, wouldn’t it?

Colin

Hi Colin ,

Logic is simple and straightforward ..but it’s not working :frowning: !!

The reason that I am assuming are

1) Three websites are on three different IP’s.

2) The Virtual directory for three web sites are different.

So when the health monitor tries to look for the .asp page other than it’s own , it does not find the directory and gives an error 404 ( file or directory not found) and eventually it marks the node as down.

Is there any possibility that iRule will monitor the website independently and decides the pool ??

Thanks & regards,

Prasad.

Hi Prasad,

An iRule cannot do monitoring activities. If you have setup monitors much like Aaron (Aka Hoolio) had stated then perhaps the next step is to log into the LTM at the shell level and run a couple of commands

You can use the telnet command to connect to the pool member and test each server IP address with the site URL that you are using as a monitor. For example:

telnet

Next, at the prompt enter an appropriate HTTP request line and HTTP headers, hitting Enter once after each line. For example:

GET /abc.asp HTTP/1.1

Host: abc.com

Connection: close

GET /123.asp HTTP/1.1

Host: 123.com

Connection: close

GET /xyz.asp HTTP/1.1

Host: xyz.com

Connection: close

This should simulate what each monitor should see as it polls the website.

I hope this helps

Bhattman

Thank you all for your valuable suggestions on my requirement !!

Finally I could achieve this with little different approach with the help of F5 supports of course !!

I split the pool into active & standby nodes and then I configured iRule to detect active members in the pool with the help of health monitor for individual pool.

below is the iRule for this config.

VS1->pool1->site1-active

VS2->pool2->site2-active

VS3->pool3->site3-active

pool4->site1-standby

pool5->site2-standby

pool6->site3-standby

For irule, there are three irules and should be applied to VS configuration seperately.

1) iRule1-->VS1:

when HTTP_REQUEST {

if { ([active_members pool1] < 1) or ([active_members pool2] < 1) or ([active_members pool3] < 1) } {

pool pool4

} else {

pool pool1

}

}

2) iRule2->VS2:

when HTTP_REQUEST {

if { ([active_members pool1] < 1) or ([active_members pool2] < 1) or ([active_members pool3] < 1) } {

pool pool5

} else {

pool pool2

}

}

3) iRule3->VS3:

when HTTP_REQUEST {

if { ([active_members pool1] < 1) or ([active_members pool2] < 1) or ([active_members pool3] < 1) } {

pool pool6

} else {

pool pool3

}

}

I am trying the opposite here. I have two web servers with 10 websites (using header for all 10 websites) equally load balanced behind F5. If one of the website goes offline i would like traffic for other 9 websites to continue to loadbalance and the traffic directed to the website that is down should go to other pool member without marking the whole server offline. I want my monitors to look at the header requests and load balance. Thanks..

Hi OZ,

You can specify a host header in the HTTP/S monitor send string:

GET /file.html HTTP/1.1\r\nHost: myhost.example.com\r\nConnection: Close\r\n\r\n

So you can create a pool and monitor per web site. If you associate a monitor with the pool (not a node) and that pool member gets marked down, it will not affect the same IP:port configured as a member in a different pool.

Aaron