Forum Discussion

IainThomson85_1's avatar
IainThomson85_1
Icon for Cumulonimbus rankCumulonimbus
Dec 31, 2014

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

  • 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)?

     

  • 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.

     

  • 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.

     

  • 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.

     

  • shaggy's avatar
    shaggy
    Icon for Nimbostratus rankNimbostratus

    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

     

  • 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!

     

  • 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...