tarsier_90410
Aug 25, 2009Nimbostratus
way 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?
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
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
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"
}
}
Aaron
Aaron
Kevin
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.