Forum Discussion
Michael_Yates
Oct 07, 2011Nimbostratus
Hi Pippin,
I really don't think that you need to go as complex as you are. If the Node failed to trigger the LB_FAILED Event, then it is dead:
LB_FAILED is triggered when LTM is ready to send the request to a pool member and one hasn’t been chosen (the system failed to select a pool or a pool member), is unreachable (when no route to the target exists), or is non-responsive (fails to respond to a connection request).
You can shorten your process by just verifying that there is another server in the pool available to take the traffic. If there is then you should not need to worry about retries. You can drop the current persistence and do a server reselect.
when HTTP_REQUEST {
The HTTP_REQUEST Event here is just for testing...
log local0. "Initial Server [LB::server name]"
}
when LB_FAILED {
Check to see if there are any available members left after the failure.
If less than 1 (Zero), redirect the Client to a Sorry Page.
if { [active_members [LB::server pool]] < 1 } {
HTTP::redirect "http://www.yahoo.com"
}
else {
Drop current persistence and LB::reselect
persist none
LB::reselect
}
}
Note: This code does not take into account the server passing a health check and being declared "Active", but still being in an unhealthy state. You can add that functionality on within the HTTP_RESPONSE and monitoring the HTTP::status codes.
Hope this helps.