Forum Discussion

Venkat_Raj_2350's avatar
Venkat_Raj_2350
Icon for Nimbostratus rankNimbostratus
Aug 08, 2016

iRule to check for the page content and force-offline node in a pool

Hi,

 

I have a pool with 4 members and each server has a html page setup as /TomCatCount.html. If the count is high then the page will display "Above Threshold" and if the count comes down "Below Threshold"

 

Is there way to monitor the page content using iRule and get the particular pool members which has "Above Threshold" to set as Force-offline (LB::down)? I tried to use the monitor (using receive disable string) but it only disables the member. I need to Force-offline it.

 

2 Replies

  • Hi Venkat,

    if a node is marked as "down" by an monitor, then its comparable to set this node manually as "Force-offline", since it does not receive any new and even persistent sessions.

    The

    [LB::down]
    command will force an fresh health monitor probe and would also mark the node temporary as "down" till the health monitor check has completed. The result of the health monitor will then keep the node "down" or flip it immediately back to "online". So i guess there is no benefit using this command...

    What the is your detailed requirement and what missing when a monitor is marking a node as "down"? Should LTM also kill any ongoing sessions to this node?

    Cheers, Kai

  • Hi Venkat,

    as I said, persistent session are transparently rebalanced to the next active node in the case that the persited node is unhealthy. You could check this behavior by using the iRule below. It uses the

    PERSIST_DOWN
    event to
    [log]
    persisted node that have been failed. After
    PERSIST_DOWN
    has been triggered, a regular
    LB_SELECTED
    event will occour, where one of the remaining nodes are getting selected...

    when PERSIST_DOWN {
        log local0.debug "Persistent Node [LB::server addr] is marked as [LB::status]"
        set persist_down 1
    }
    when LB_SELECTED {
        if { [info exists persist_down] } then {
            log local0.debug "New node selection is [LB::server addr]"
            unset -nocomplain persist_down
        }
    }
    

    To kill even the active session (Remark: Active Session =/= Peristent Sessions) to your backend systems, you have to query the currently [active_members] on every single TCP packet, that is going to be send to your pool members and then trigger a TCP::close or

    reject
    if the currently selected node is not marked as "online"...

    when SERVER_CONNECTED {
        TCP::collect
    }
    when SERVER_DATA {
        if { [active_members -list [LB::server pool]] contains [LB::server addr] } then {
            TCP::release
        } else {
             Use TCP::close to close the connection after the next response
    
            TCP::close
    
             User reject to terminate the request immediately
    
             reject 
        }
    }
    

    Note: Keep in mind, that the iRule above produces a a huge performance overhead, since the

    SERVER_DATA
    event and the containing script block is triggered on every single TCP packet that is send to your pool members.

    Cheers, Kai