Forum Discussion

Shawn_Higgin_84's avatar
Shawn_Higgin_84
Icon for Nimbostratus rankNimbostratus
Jun 25, 2005

How to redirect if less than x nodes are avail

I was wondering if anyone knoes how do setup a iRule to do a redirect if there are less than x nodes available within a pool. Is there an easy way to do this? I have it working if there are no nodes available.

 

 

Also, is there a way to have the F5 send out an SNMP Trap within an IRule or a Syslog message?

 

 

Thanks,

 

 

Shawn
  • You don't need an iRule. In the pool config you can set a minimum available number of nodes. (And configure the behavior if this happens)

     

     

    -Brian
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    If you need to use a rule, you can use the command:

    active_members 

    This will return the number of active pool members in the pool.

    Also, you can generate a log entry from the iRule and then add a configuration line to /etc/alertd/alert.conf to have alertd generate an snmp trap for you (you will likely have to restart alertd with "bigstart restart alertd"). Your alert line would look something like this:

     
     alert BIGIP_RULES_RULESERR_RULE "^Rule (.*?): SNMPTRAP" { 
        snmptrap OID=".1.3.6.1.4.1.3375.2.4.0.50" 
     } 
     

    The following iRule should then generate the trap.

     
     when HTTP_REQUEST { 
        if { [HTTP::uri] contains "debug" } { 
           log local0. "SNMPTRAP - Request for debug" 
        } 
     } 
     
  • I would like to do something similar -

    I need to configure a pool/vip so that if < X nodes are available - the entire vip is unavailable. Nightly this applcation is restarted, the first node that comes online gets hammered by connecting clients. The way our application works, combined with persistence method we use, means that nearly all clients will be on one node while the others are empty.

    Would be awesome if I could just to use something simple like:

    
    pool my_pool {
    lb method member least conn
    min active members 2
    monitor all some-test
    member 10.12.10.7:80 priority 1
    member 10.12.10.8:80 priority 1
    member 10.12.10.8:80 priority 1
    }

    but doesnt look like that is how priority group act works.

    Slow ramp time doesn't work since for some finite amount of time there is only one node available in the pool.

    Perhaps an iRule would be best - anyone have anything they use or ideas?
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Well, are you looking to have the clients redirected to another location until there are at least two servers available in the pool, or are you looking to have the connections rejected completely, as if the pool were still down?

     

     

    We can accomodate either of those things.

     

     

    Colin
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    That would be a relatively simple iRule:

     

     

    
    when HTTP_REQUEST {
      if { [active_members http_pool] < X } {
        reject
      }
    }

     

     

    X would be changed to the minimum number of active members, of course.

     

     

    This code is almost identical to the example in the Wiki on the active_members page: Click here

     

     

    HTH,

     

    Colin