For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Christian_Laute's avatar
Christian_Laute
Icon for Nimbostratus rankNimbostratus
Jul 01, 2016

iRule checking Pool is down

Gents, maybe you can help me out. I need an irule to check the availability of a pool. Usually I used the command

 

[...] if { [active_members [LB::server pool]] == 0 } [...]

 

but the disadvantage of this solution is that it does not catch disabled nodes. When I set all members to a pool to disable the status of the pool itself is still up because persistance sessions should still have access. But the irule above checks the status of the members. Disabled members are no active members so the irule becomes active and shows the errorpage.

 

Is there no possibility to check availability status of the pool itself or a query like this?

 

[...] if { [active_members [LB::server pool]] == 0 } and { [disabled_members [LB::server pool]] == 0 } [...]

 

Many thanks for your help. Tried to search for it but found no article...

 

Cheers Chris

 

4 Replies

  • I don't understand what you propose very well, but it might help you:

    when HTTP_REQUEST {
        set up 0
        set down 0
        set disabled 0
        foreach member [members -list [LB::server pool]] {
            set status [LB::status pool [LB::server pool] member [lindex $member 0] [lindex $member 1]]
            switch $status {
                "up" {
                    incr up 1
                }
                "down" {
                    incr down 1
                }
                "session_disabled" {
                    incr disabled 1
                }
            }
        }
        log local0. "===> [LB::server pool] members (Active: $up) (Down: $down) (Disabled: $disabled)"
        unset up down disabled
    }
    

    Regards.

  • Great, many thanks. I did some modifications and now it works like it should. I really appreciate your help.

    when HTTP_REQUEST {
        set up 0
        set down 0
        set disabled 0
        foreach member [members -list [LB::server pool]] {
            set status [LB::status pool [LB::server pool] member [lindex $member 0] [lindex $member 1]]
            switch $status {
                "up" {
                    incr up 1
                }
                "down" {
                    incr down 1
                }
                "session_disabled" {
                    incr disabled 1
                }
            }
        }
    
        log local0. "Errorpage output: [LB::server pool] members (Active: $up) (Down: $down) (Disabled: $disabled)"
    
    
    
    if {$up == 0}   {
        if {$disabled == 0} {               HTTP::respond 200 content {
    
    
    
    
                                        ************************************************************************************************
                                        E-R-R-O-R: Sorry - no Node with status ACTIVE or DISABLED found!!! 
                                        ************************************************************************************************
    
                                                                        }
                            }
    
    
                    } 
    
    unset up down disabled
    }
    
  • Great, many thanks. I did some modifications and now it works like it should. I really appreciate your help.

    when HTTP_REQUEST {
        set up 0
        set down 0
        set disabled 0
        foreach member [members -list [LB::server pool]] {
            set status [LB::status pool [LB::server pool] member [lindex $member 0] [lindex $member 1]]
            switch $status {
                "up" {
                    incr up 1
                }
                "down" {
                    incr down 1
                }
                "session_disabled" {
                    incr disabled 1
                }
            }
        }
    
        log local0. "Errorpage output: [LB::server pool] members (Active: $up) (Down: $down) (Disabled: $disabled)"
    
    
    
    if {($up == 0) and ($disabled == 0)}    {
        HTTP::respond 200 content {
    
    
    
    
                                        ************************************************************************************************
                                        E-R-R-O-R: Sorry - no Node with status ACTIVE or DISABLED found!!! 
                                        "Errorpage output: [LB::server pool] members (Active: $up) (Down: $down) (Disabled: $disabled)"
                                        ************************************************************************************************
    
    
                                    }
    
    
                                            } 
    
    unset up down disabled
    }
    
  • Now I understand what you were looking for, so why don't you simple do this way:

    when HTTP_REQUEST {
        if { [catch { eval [LB::select] }] } {
            HTTP::respond 200 content {
                ************************************************************************************************
                E-R-R-O-R: Sorry - no Node with status ACTIVE or DISABLED found!!! 
                ************************************************************************************************
            } Connection close
        }
    }
    

    Thus, when no members active in pool, the new connections will get sorry page immediately, and for the member disabled the current connections keep working till it end.

    Respectfully.