Forum Discussion
Marcus_59536
Nimbostratus
Sep 03, 2009iRUle to check current pool member and show if its up.
I currently can see if the current pool is up and name, but I can't see the pool server IP until I actually manually make the F5 make a LB decision.
How can I make that decision within/before this HTTP_REQUEST?
HTTP_REQUEST:
when HTTP_REQUEST {
set current_pool [LB::server pool]
set response "$current_pool Pool Status - [clock format [clock seconds]]"
if {[HTTP::uri] eq "/status" } {
set current_port [LB::server port]
set current_member [LB::server addr]
if { [active_members [LB::server pool] ] < 1 } {
set response "$response POOL NAME:$current_pool
CURRENT SERVER:$current_member:$current_port
STATUS: DOWN
"
} else {
set response "$response NAME:$current_pool
CURRENT SERVER:$current_member:$current_port
STATUS: UP
"
}
HTTP::respond 200 content $response "Content-Type" "text/html"
}
}
These all show up as NULL until I manually make a LB decision. How can I change this to work as I planned?
Thanks
- The_Bhattman
Nimbostratus
You have to select the pool iin your code before the rest of the your code elements come together. - Marcus_59536
Nimbostratus
I don't know the name of the pool until I call [LB::server pool]. I changed the code to this: - The_Bhattman
Nimbostratus
I believe I see where your problem is. I think the problem stems for the actual load balancing selection that is occurring. taking that into account and doing some tweaking I think this might work nicely for youwhen HTTP_REQUEST { if {[HTTP::uri] eq "/status" } { scan [LB::select] %s%s%s%s%d command current_pool command2 current_member current_port eval [LB::select] set response "$current_pool Pool Status - [clock format [clock seconds]]" if { [active_members $current_pool] < 1 } { append response "POOL NAME:$current_pool CURRENT MEMBER:$current_member:$current_port STATUS: DOWN " } else { append response "POOL NAME:$current_pool CURRENT MEMBER:$current_member:$current_port STATUS: UP " } } HTTP::respond 200 content $response "Content-Type" "text/html" }
- hoolio
Cirrostratus
Nice rule, CB. - Marcus_59536
Nimbostratus
Thanks, that works exactly as I wanted it to. - milo
Nimbostratus
Is there a way to data groups with the pool member status irule? It looks like I should be able to make the selectedpool a variable and be able to choose a data group based on a string in the requested URI. - The_Bhattman
Nimbostratus
Hi Milo, - milo
Nimbostratus
I apologize, I need to proofread my posts. Let's say I have 20 vips being supported by two teams, A & B. Team A supports the first 10 and team B the second 10. And, they don't care about the pool status of the vips being supported by the other team. In that case, it would be better to have two data groups that reference different external files. Can I modify the pool_member_status_page irule to select either data group to populate the status page? - The_Bhattman
Nimbostratus
Hi Milo, - milo
Nimbostratus
Can you provide an example on how to do that?
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects