Forum Discussion
Can anyone see anything wrong with these I-Rules?
Hi I am new to writing I-Rules and have put an I-Rule together that is quite simple and I think will work but am wondering if there is something obviously wrong with them before I implement them.
For a number of reasons I won't get into here, we are using an internet based global load balancing service that sends a basic get request to a VIP on an LTM. Basically if the servers in the LTM pool are up, the LTM responds with a 200. If the servers are down, it responds with a 404 or some error message, and the global LB will direct incoming requests to the backup data center.
Here is what I have put together. Is there something obviously wrong or may have missed?
rule TEST { when HTTP_REQUEST { if { [active_members [ LB::Test_Pool]] > 0 } { HTTP::respond 200
} else { HTTP::respond 404 } } }
where the Global Load Balancing service issues an HTTP request..
Thanks in advance.
Ken
3 Replies
- cjunior
Nacreous
The problem is the argument "[ LB::Test_Pool]", see: https://devcentral.f5.com/wiki/iRules.active_members.ashx
rule TEST { when HTTP_REQUEST { if { [active_members Test_Pool] > 0 } { HTTP::respond 200 } else { HTTP::respond 404 } } }
Hope it helps.
- Michael_Jenkins
Cirrostratus
Did you get a chance to check out the active_members wiki page, the LB::server pool command and the iRules 101 page on pools and members and such? They have some more specific details on this.
I think your iRule may need a little tweak to get the pool name when checking for active members. You can either use
to specify a pool name. Otherwise you could use[active_members POOL_NAME]
instead to get whatever the currently set pool is. (And I'd include the "Connection Close" header on the return as well)[active_members [LB::server pool]]rule TEST { when HTTP_REQUEST { if { [active_members POOL_NAME] > 0 } { HTTP::respond 200 content "" Connection Close } else { HTTP::respond 404 content "" Connection Close } } } - Kdedesko_49781
Nimbostratus
Thanks, to both of you....This really helps. Ken
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