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?
62 Replies
- hoolio
Cirrostratus
Hi Kevin,
That's a very thorough and handy set of examples to do this in a fairly straightforward way without iControl. And it doesn't even involve setting up a cronjob!
Aaron - hoolio
Cirrostratus
Nice updates, Citizen. I'd read that append is more efficient than set var "$var$stuff", but it's nice to see it proved out.
I guess you could eek out a few CPU cycles by replacing some of the appends:append response "" append response "$thispool status" append response "$thispool is DOWN" append response ""
with:append response "\ $thispool status\ $thispool is DOWN\ "
Aaron - JRahm
Admin
True. So I eliminated as many appends as I could and reran the test without the pool member section, then added it back in for a test as well. So here are the final numbers, followed by the more-optimized version:
1) Original Version - 493901 avg cycles
2) Changed sets to appends - 436453 avg cycles
3) Minimized append statements - 414210 avg cycles
Definite savings! Adding the pool member code, however, shoots it back up (650614 avg cycles), and will do more so depending on how many pools & pool members you have.when HTTP_REQUEST { set response " \ BigIP Server Pool StatusServer Pool Status \ en[clock format [clock seconds]]60" if { [HTTP::uri] eq "/status" } { foreach { selectedpool } [class get pooltest] { set thispool [getfield $selectedpool " " 1] if { [catch { if { [active_members $thispool] < 1 } { append response "$thispool status$thispool is \ DOWN" } else { append response "$thispool status$thispool is \ UP" Member Status Section for "UP" pools" append response "$thispool member status foreach { pmem } [members -list $thispool] { append response "Pool Member [join $pmem ":"] is \ [LB::status pool $thispool member [getfield $pmem " " 1] [getfield $pmem " " 2] ] " } append response "\]\]>" End Member Status Section } } errmsg ] } { append response "$thispool ERROR \ Invalid pool name: $thispool" } } append response "" HTTP::respond 200 content $response "Content-Type" "text/xml" } } - hoolio
Cirrostratus
Nice. Is there any difference between using [active_members $pool] compared with '[LB::status $pool] eq "UP"'?
Aaron - JRahm
Admin
I don't think you can get pool status with the LB::status command, only nodes or pool members. [LB::status $thispool] passes syntax check, but doesn't return anything. Specifying the pool keyword requires additional arguments for members, which isn't what we want. Any other ideas? - hoolio
Cirrostratus
Ah... somehow I always had it in my head that you could get the pool state--not just pool members using LB::status.
Aaron - The_Bhattman
Nimbostratus
This post is definitely evolving. I am sorry we could answer tarsier's original questions but this inspired fantastic contributions - Kevin_Stewart
Employee
Could or couldn't answer tarsier's original question? Didn't we?
Kevin - tarsier_90410
Nimbostratus
My original question was resolved with Kevin's shell script.
All the further contributions are very interesting as well. I never considered using an RSS feed to provide notifications, nor did I realize how simple they are to create. - The_Bhattman
Nimbostratus
I love my spell checker. Couldn't is what I wanted to say, but yes I read your posting fully and indeed you posted a solution.
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
