Forum Discussion
NetSnoopy
Jun 10, 2020Cirrus
Pool Member Status and how QTYPE works?
Hello,
i wrote a small Irule for show the Pool Member status as json.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "f5_status.XXXX.com" } {
#update Poollist, enter Pool names
set poolname "P_X_http80 P_XX_http80 P_XXX_https6443"
#update RootPartition for replacement
set stringmap "\"%1234 \" \"\:\""
set poolnummer 1
set json "\{\"status\"\:\{\"time\"\:\"[clock format [clock seconds] -format "%Y-%b-%dT%H:%M:%S %Z"]\","
foreach pool_n $poolname {
set list_all ""
set list_up ""
set list_down ""
set member ""
set member_l ""
foreach member [members -list $pool_n ] {
set member_l "[string map $stringmap $member]"
append list_all "\"$member_l\","
}
set member ""
set member_l ""
foreach member [members -list $pool_n ] {
if { !([active_members -list $pool_n ] contains $member) }{
set member_l "[string map $stringmap $member]"
append list_down "\"$member_l\","
}
}
set member ""
set member_l ""
foreach member [active_members -list $pool_n ] {
set member_l "[string map $stringmap $member]"
append list_up "\"$member_l\","
}
set count_a [active_members $pool_n]
set count [members $pool_n]
set count_d [expr {$count} - {$count_a} ]
append json "\"pool$poolnummer\"\:\{\"name\"\:\"$pool_n\",\"member count active\"\:$count_a,\"member count down\"\:$count_d,\"member count all\"\:$count,\"member active\"\:\[[string trimright $list_up ","]\],\"member down\"\:\[[string trimright $list_down ","]\],\"member all\"\:\[[string trimright $list_all ","]\]\},"
incr poolnummer
}
set json [string trimright $json ","]
append json "\}\}"
HTTP::respond 200 content "$json" "Content-Type" "application/json"
}
}
But i found that new implementation
#v12 change to include QTYPE
members [-list] [QTYPE] <poolName> [blue green yellow red gray]
https://clouddocs.f5.com/api/irules/members.html or https://clouddocs.f5.com/api/irules/active_members.html
Anyone know how this work or have a working irule with this "qtype"? I would like to see a example!
- cjuniorNacreous
Hi,
The QTYPE param is exclusive for GTM pool and used on GTM iRules.
When not defined, QTYPE has "A" as the default value.
Note: GTM does not support the -list option
e.g.
https://clouddocs.f5.com/api/irules/DNS_REQUEST.html
when DNS_REQUEST { # Changed = = 0 to < 1 for CR100063 / SOL10137 if { [active_members pool_test] < 1 } { cname "something.domain.com" } }
# Similar if { [active_members A pool_test] < 1 } {
Regards.
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