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
I don't believe there is a single command or a set of commands that that can easily query ALL pools in the system, unless all your pools are similarly named but denoted with numbers for example pool1 to pool32. Then you can write an iRule that would loop through each iteration of the pool name and thus list our all the pools. Otherwise, the CLI is pretty much the only place where single command can list out all the pools. - hoolio
Cirrostratus
It's generally useful to name the pools using a format like app-name_protocol_pool so that you know what the pool is used for by the name. Maybe you can provide some background on what you're trying to accomplish and we can provide a suggestion. - tarsier_90410
Nimbostratus
Thanks for the feedback. We do not have iControl, and I am trying to create a read-only dashboard for our app developers to check to see if various pools are up or down. I would prefer to not manually edit the list each time I setup/tear down a pool. - hoolio
Cirrostratus
That's a novel approach for providing stats from an iRule. Short of manually listing all the pools in a datagroup, and possibly updating it via iControl or manually, I don't see an option to do this from an iRule. - The_Bhattman
Nimbostratus
Then I think you hit a limitation from this perspective. However it is the most common item that a lot of people have been requesting. Perhaps opening a case with F5 as a future feature will help. I also found your particular code useful for some clients who need a quick pulse on the current pool they have selected on the vip. I have posted it up for you - tarsier_90410
Nimbostratus
Thanks, will look into iControl to see what else I can do. - The_Bhattman
Nimbostratus
Take a look at something that may prove to be useful to you - Kevin_Stewart
Employee
As with your "set POOLS {}" list example, you can enumerate the pool names from a class. If you use an external class you can use an external monitor script to modify that file at intervals. You'll need to do a "b load" in the script once the file is created, so I'd probably set the monitor on an unused pool and set it to some long interval, perhaps once a day."apache_pool", "iis_pool", "coldfusion_pool", "java_pool",
when HTTP_REQUEST { set response "BIGIP Pool Status - [clock format [clock seconds]]" if { [HTTP::uri] eq "/status" } { foreach { selectedpool } [class get pooltest] { set thispool [getfield $selectedpool " " 1] if { [catch { if { [active_members $thispool] < 1 } { set response "$response DOWN - $thispool " } else { set response "$response UP - $thispool " } } errmsg ] } { set response "$response INVALID POOL NAME - $thispool " } } set response "$response " HTTP::respond 200 content $response "Content-Type" "text/html" } }
- Kevin_Stewart
Employee
Here's what the external monitor might look like:!/bin/bash b pool all name |awk '{ print "\"" $2 "\","}' >/var/class/testclass tmsh show ltm pool |grep Pool: |awk '{ print "\"" $2 "\"," }' >/var/class/testclass b load
- Kevin_Stewart
Employee
Not to be a post hog, but here's another version of the iRule that turns it into an RSS feed:when HTTP_REQUEST { set response "" set response "$response BigIP Server Pool Status" set response "$response Server Pool Status" set response "$response en" set response "$response [clock format [clock seconds]]" set response "$response 60" if { [HTTP::uri] eq "/status" } { foreach { selectedpool } [class get pooltest] { set thispool [getfield $selectedpool " " 1] if { [catch { if { [active_members $thispool] < 1 } { set response "$response " set response "$response $thispool status" set response "$response $thispool is DOWN" set response "$response " } else { set response "$response " set response "$response $thispool status" set response "$response $thispool is UP" set response "$response " } } errmsg ] } { set response "$response " set response "$response $thispool ERROR" set response "$response Invalid pool name: $thispool" set response "$response " } } set response "$response " set response "$response " HTTP::respond 200 content $response "Content-Type" "text/xml" } }
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