Forum Discussion
Irule for redirect when all pool members down, need one for each pool? and what is the standard practice for sorry server?
This is what I have for an iRule to implement when all members of a pool are not available due to maintenance or unplanned outage
when HTTP_REQUEST { if { [active_members EXAMPLETEST_POOL] == 0 } { HTTP::redirect "http://209.196.27.42/" } }
Now this is for one pool, we have over 10 pools. Is there a way to re-write this so the same iRule can be applied to each virtual server? Or do I need to create a separate iRule for each pool?
Lastly, the re-direct is going to one server serving the web page. This has to be mapped to a public IP at the firewall with the non-nat'd IP as the virtual server for that web server. Then a DNS record created for that public IP address.
Is this the typical practice for a sorry server? Are there any steps I can take to mitigate any risks if any in my present setup?
Thanks,
20 Replies
- hoolio
Cirrostratus
You can use [LB::server pool] to get the currently selected pool instead of hardcoding it in the iRule. Your network config for the sorry VS seems standard.
Aaron - dmenardSABA_235
Nimbostratus
Aaron,
thanks, so you are saying instead of [active_members ] you would use [active_members LB:::server pool]? - Michael_Yates
Nimbostratus
Hi dmenardSABA,
I think that what Hoolio is saying is that you don't have to hard code the pool name in the iRule. If you use [LB::server pool] that it will use the default pool assigned to the Virtual Server.when HTTP_REQUEST { if { [active_members [LB::server pool]] == 0 } { HTTP::redirect "http://209.196.27.42/" } } - dmenardSABA_235
Nimbostratus
Thanks to you both. I'll give that a try with that change. Regarding the standard practice for a sorry server I am still open to knowing what other are doing?
Thanks again,
Dave - Michael_Yates
Nimbostratus
I would say that there is no best practice. There is only "what best fits your situation".
I use a combination of redirects for custom content vanity splash and sorry pages and iRules.
Here is a basic example:when HTTP_RESPONSE { HTTP::respond 200 content "Site unavailable System Maintenance NOTICE: This site is down for maintenance. " } - Techgeeeg
Nimbostratus
Hi Everyone,
I had a similar requirement of iRule as the one written here... Michael I need to know one thing from you... how can I merge the irule...
when HTTP_REQUEST {
if { [active_members [LB::server pool]] == 0 } {
HTTP::redirect "http://209.196.27.42/"
}
}
With this....
when HTTP_RESPONSE {
HTTP::respond 200 content "Site unavailableSystem Maintenance NOTICE: This site is down for maintenance.
"
}
when HTTP_REQUEST {
if { [active_members [LB::server pool]] == 0 } {
HTTP::redirect "http://209.196.27.42/"
}
}when HTTP_REQUEST {
if { [active_members [LB::server pool]] == 0 } {
HTTP::redirect "http://209.196.27.42/"
}
} - nitass
Employee
how can I merge the irule... what action do you want to take when pool is down? is it redirection to http://209.196.27.42/ or responding maintenance page?? - Techgeeeg
Nimbostratus
Hi Nitas,
It's been some time I was not able to get back due to some issues .... well getting back to the topic.... what I need to do is when the first part has checked that all the pool members are down then I simply want to display a message that the Site is down for maintenance how can i achieve this.
Regards, - Techgeeeg
Nimbostratus
Hi Nitas,
It's been some time I was not able to get back due to some issues .... well getting back to the topic.... what I need to do is when the first part has checked that all the pool members are down then I simply want to display a message that the Site is down for maintenance how can i achieve this.
Regards, - Kevin_Davies_40
Nacreous
when HTTP_REQUEST { if { [active_members [LB::server pool]] == 0 } { HTTP::respond 200 content " " } }
Recent Discussions
Related Content
* 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
