Forum Discussion
iRule to display site down irrespective of the state of pool members
Hi, I want to create an iRule to display site down page irrespective of the state of the pool members i.e. if the pool members are active or down, it should redirect to site down page.
I have created an irule to redirect when the pool members are down. How can I modify it to redirect for both the conditions?
when HTTP_REQUEST {if { 0 == [active_members [LB::server pool]]}{HTTP::respond 503 content {.......}}}
Thanks
7 Replies
- DEJ_159363
Cirrus
Hi Raghav,
An easy way to do this would be to set a variable for comparison. In the below example, you would change the value of 'SiteDown' to 1 to manually enable the maintenance page. When set to 0, it would only redirect if there were less than 1 pool member available. Please let me know if you have further questions.
when HTTP_REQUEST { Set SiteDown to 1 to enable maintenance page set SiteDown 0 if {($SiteDown == 1) || ([active_members [LB::server pool]] < 1)}{ HTTP::respond 503 content {.......} } }- Samir_Jha_52506
Noctilucent
Hi Dareuja, Can you please paste full irule. I am bit confused here. - DEJ_159363
Cirrus
Hi Samir, I do not have the full iRule, this is based on Raghav's request, which is why the content is blank. The iRule is a simple conditional statement using OR. If SiteDown equals 1 or there are no active pool members, the content is offered.
- DEJ
Nimbostratus
Hi Raghav,
An easy way to do this would be to set a variable for comparison. In the below example, you would change the value of 'SiteDown' to 1 to manually enable the maintenance page. When set to 0, it would only redirect if there were less than 1 pool member available. Please let me know if you have further questions.
when HTTP_REQUEST { Set SiteDown to 1 to enable maintenance page set SiteDown 0 if {($SiteDown == 1) || ([active_members [LB::server pool]] < 1)}{ HTTP::respond 503 content {.......} } }- Samir_Jha_52506
Noctilucent
Hi Dareuja, Can you please paste full irule. I am bit confused here. - DEJ
Nimbostratus
Hi Samir, I do not have the full iRule, this is based on Raghav's request, which is why the content is blank. The iRule is a simple conditional statement using OR. If SiteDown equals 1 or there are no active pool members, the content is offered.
- VernonWells
Employee
If you are going to take this action unequivocally, then there is no need to associate a pool with the Virtual Server at all, unless, of course, you are going to "turn on" and "turn off" this feature. If that's the way you intend to approach it, however, you might consider leaving the rule as-is, and when you want to active the feature, simply disable all of the pool members.
In any case, if you wish to do this without condition, it is simply:
when HTTP_REQUEST { HTTP::respond 503 content { ... } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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