Forum Discussion
Tear Down VIP based on pool selection in iRule
Good Afternoon,
I have a bit of a query if this is possible,
We have a Pool Selection based on the part of a URI host,
The VIP that this is tied to is monitored by a GTM, what I want to do is Tear down the VIP service if Pools in the selected class have 0 members available, and subsequently get re-enabled when the Pool member is "fixed"
I cant' work out the best way to do it, I've supplied the rule and class below.
Rule
ltm rule pool_selection_rule { when HTTP_REQUEST { set app_pool [class match -value -- [string tolower [HTTP::uri]] starts_with pool_selection_class] if {$app_pool ne ""} { pool $app_pool } else { return } } }
ltm data-group internal pool_selection_class { records { /URI1 { data URI1_9089_pool1 } /URI2 { data URI2_9090_pool1 } /URI3 { data URI3_9091_pool1 } /URI4 { data URI4_9092_pool1 } /URI5 { data URI5_9093_pool1 } } type string }
12 Replies
- nitass
Employee
ltm data-group internal pool_selection_class { records { /URI1 { data URI1_9089_pool1 } /URI2 { data URI2_9090_pool1 } /URI3 { data URI3_9091_pool1 } /URI4 { data URI4_9092_pool1 } /URI5 { data URI5_9093_pool1 } } type string }
is the actual uri in data group in small letters (because string tolower is used in the irule)?
- IainThomson85_1
Cumulonimbus
Apologies, I've just edited that to remove some identifiable information. so yes, the pool/string in the data-group is lowercase.
The rule is functional currently, however if one of the "URI" pools, goes down it will not tear the VIP down in current state.
- Brad_Parker
Cirrus
You could try custom HTTP(S) monitors on the GTM to monitor each application in the VIP or an iCall script to query the status of the pool on the LTM from the GTM.
- Brad_Parker
Cirrus
Should have said iControl not iCall. - Brad_Parker
Cirrus
You may also explore iCall using this example to see if it would work for you, https://devcentral.f5.com/wiki/iCall.GTM_Monitor_Weight_Change.ashx
- Brad_Parker_139
Nacreous
You could try custom HTTP(S) monitors on the GTM to monitor each application in the VIP or an iCall script to query the status of the pool on the LTM from the GTM.
- Brad_Parker_139
Nacreous
Should have said iControl not iCall. - Brad_Parker_139
Nacreous
You may also explore iCall using this example to see if it would work for you, https://devcentral.f5.com/wiki/iCall.GTM_Monitor_Weight_Change.ashx
- shaggy
Nimbostratus
agree with @brad parker. iCall is probably the better tool for bringing a virtual server up/down based on pool-statuses. iRules are traffic-driven and event-based, so the vs up/down action can only be performed when the iRule processes traffic. If the virtual server is disabled and GTM never resolves the hostname to the virtual address (because the virtual servers are down), then the iRule will never receive traffic to bring the virtual server back up.
check out https://devcentral.f5.com/wiki/iCall.Homepage.ashx and https://devcentral.f5.com/wiki/iCall.Disable-Interface-if-Pool-Member-Availability-Drops-Below-Threshold.ashx
- IainThomson85_1
Cumulonimbus
Thank you Brad Parker and Shaggy,
This is going to be a fun one to try shoe-horn in, as I'll need to get a software upgrade done from 11.3.x .
Then actually learn how to script very quickly, but thank you for the foundations of the idea!
- Mahmoud_Eldeeb_
Cirrostratus
iCall script can do query the status of the pool on the LTM from the GTM.
- IainThomson85_1
Cumulonimbus
So to keep everyone updated on the solution gone for, As i'm not the strongest scripter in the world, and there is a time requirement around this for implementation.
We have setup some "Dummy" Virtual Servers, with the URI Pools beneath them.
The GTM then monitors these Virtual Servers, and the main service has dependencies on the URI Virtual servers etc etc...
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