Forum Discussion
tarsier_90410
Nimbostratus
Aug 25, 2009way to list pools?
I am trying to find a way for an irule (9.x LTM) to query for a list of all pools on the system, but so far have not found a way to do so. Is this possible?
The_Bhattman
Nimbostratus
Aug 30, 2009Here is another variation of the same type of formula for v9.x
1. Create a file in the following path
/etc/cron.daily/pool_member_status_list.cron
which contains
!/bin/bash
b pool all member all | grep pool_ | awk '{print "\""$3"\""}' | sort > /var/class/pool_member_status_list.class
b load
exit 0
2. Change the permissions by entering
chmod +755 /etc/cron.daily/pool_member_status_list.cron
3. Create a external datagroup
Main >> Local Traffic >> iRules
Select Data Group List
Click create
enter name: pool_member_status_list
enter Type: External
Path / Filename: /var/class/pool_member_status_list.class
File Content: String
4.
when HTTP_REQUEST {
if { [HTTP::uri] eq "/status" } {
set response "BIGIP Alpharetta Pool Member Status - \ <br> [clock format [clock seconds]]BIGIP Alpharetta Pool Member Status - [clock format [clock seconds]]\
StatusPool NameMemberPort" foreach { selectedpool } $::pool_member_status_list { if { [catch { scan [split [getfield $selectedpool " " 1] "/"] %s%s poolname addrport scan [split $addrport ":"] %s%d addr port switch -glob [LB::status pool $poolname member $addr $port] { "up" { append response "UP\ [string tolower $poolname]$addr$port" } "down" { append response "DOWN\ [string tolower $poolname]$addr$port" } "session_enabled" { append response "ENABLED\ [string tolower $poolname]$addr$port" } "session_disabled" { append response "DISABLED\ [string tolower $poolname]$addr$port" } Default { append response "INVALID\ [string tolower $poolname]$addr$port" } } SWITCH END } errmsg] } { append response "INVALID\ [string tolower $poolname]$addr$port" } SECOND CONDITIONAL STATEMENT END - Catch end error in an invalid named or non-existant pool } FOR LOOP END append response ""
HTTP::respond 200 content $response "Content-Type" "text/html"
}
FIRST CONDITIONAL STATEMENT END
}
Enjoy
CB
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
