Forum Discussion

Charles_Harris's avatar
Charles_Harris
Icon for Nimbostratus rankNimbostratus
Dec 12, 2008

Health Monitor Min Avail Members

Hi,

 

 

I've written a monitor for disabling all of a pool's members should a minimum number be unavailable (all disabled + session states) with the idea that it could be targeted to the pool. I can't get it to work targeted to a pool though, it only works when targeted to a member of the pool.

 

Any ideas / pointers?

 

 

Cheers,

 

 

ChaZ

 

 

 

3 Replies

  • When I need to provide this functionality, I use another virtual server (with an iRule that checks the minimum members requirement for the target pool) as the target for a monitor assigned to the pool rather than an external script. This approach has the advantage of using all organic mechanisms, of being supported by F5 support, and of no risk of an external script causing a system failure.

    The example below assumes two different pools of 10 members (any service), one which has a 40% available members requirement and the other with 60% availability.

    Assign the appropriate monitor to the pool and require all monitors - when the monitor fails, the virtual server is disabled and the route advertisement withdrawn from dynamic routing (if in use). When used in conjunction with GTM, the wideip will stop delivering the destination address of the virtual server.

    The configuration of the additional virtual server that is used just for monitoring:

     
     virtual vs_percent_avail { 
        destination 5.5.5.6:http 
        ip protocol tcp 
        vlans stealth enable 
        rules pool_percent_check 
        profiles 
           http 
           tcp 
     } 
      
     

    The irule applied to the additional virtual server:

    (The positive answer when no members are available is required to let the other monitors fire when the minimum available members threshold hasn't been met.)

     
      
     when HTTP_REQUEST { 
     switch -glob [http_uri] { 
     "/40" { 
     if { [active_members web_pool_secondary] == 0 } { 
     log local0. "40% check - no members in pool" 
     HTTP::respond 200 content "UP" 
     } 
     elseif { [active_members web_pool_secondary] >= 4 } { 
     log local0. "40% check good" 
     HTTP::respond 200 content "UP" 
     } 
     else { 
     HTTP::respond 503 
     } 
     } 
     "/60" { 
     if { [active_members web_pool_primary] == 0 } { 
     log local0. "60% check - no members in pool" 
     HTTP::respond 200 content "UP" 
     } 
     elseif { [active_members web_pool_primary] >= 6 } { 
     log local0. "60% check good" 
     HTTP::respond 200 content "UP" 
     } 
     else { 
     HTTP::respond 503 
     log local0. "60% check fail" 
     } 
     } 
     default { 
     HTTP::respond 503 
     log local0. "monitor check error [http_uri]" 
     } 
     } 
     } 
     

    A couple of monitors applied to pools with different minimum members requirements:

     
     monitor pool_percent_40 { 
        defaults from http 
        dest 5.5.5.6:http 
        recv "UP" 
        send "GET /40" 
     } 
      
     monitor pool_percent_60 { 
        defaults from http 
        dest 5.5.5.6:http 
        recv "UP" 
        send "GET /60" 
     } 
      
     
  • Hi ismith,

     

     

    Thanks for the detailed reply! - I wasn't even aware that F5 had a supported method of doing this, I've been asking why it's not standard feature for ages....

     

    I like your implementation as our one relies on the external script as you mentioned, we've been using a variation of it for years without issue I just wondered why I could never target the pool and have it work?! - I'll set up your suggestion on our test env as it's a nice implementation and should be F5 supported as you advise.

     

     

    Thanks again!!

     

     

    -=ChaZ=-

     

     

  • John_Alam_45640's avatar
    John_Alam_45640
    Historic F5 Account

    Updated version:

    when HTTP_REQUEST { 
        switch [HTTP::uri] { 
        "/40" { 
            if { [active_members web_pool_secondary] == 0 } { 
                log local0. "40% check - no members in pool" 
                HTTP::respond 200 content "UP" 
                } 
            elseif { [active_members web_pool_secondary] >= 4 } { 
                log local0. "40% check good" 
                HTTP::respond 200 content "UP" 
                } 
            else { 
                HTTP::respond 503 
                } 
            } 
        "/60" { 
            if { [active_members web_pool_primary] == 0 } { 
                log local0. "60% check - no members in pool" 
                HTTP::respond 200 content "UP" 
                } 
            elseif { [active_members web_pool_primary] >= 6 } { 
                log local0. "60% check good" 
                HTTP::respond 200 content "UP" 
                } 
            else { 
                HTTP::respond 503 
                log local0. "60% check fail" 
                } 
            } 
        default { 
            HTTP::respond 503 
            log local0. "monitor check error [HTTP::uri]" 
            } 
        } 
    }