Forum Discussion
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
- cjunior
Nacreous
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.
- Christian_Laute
Nimbostratus
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 } - Christian_Laute
Nimbostratus
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 } - cjunior
Nacreous
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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
