Forum Discussion
Pool Member status page iRule Version 11
I'm trying to get the pool member status page iRule to work using tmsh commands. Everything seems to be working fine but the status for all the members is showing INVALID.
I'm using the Joel Moses Version of the iRule without the rss portion https://devcentral.f5.com/wiki/irules.Pool__Member__Status__Page_on_a__Virtual__Server_v10.ashx
Here is the bash script I'm using. If I change the script to use b commands like in the above link everything works.
!/bin/bash
tmsh modify sys db bigpipe.displayservicenames value false
rm -f /var/class/pool_member_status_list.class
for POOLNAME in `tmsh list ltm pool | grep -i "ltm pool" | sort | awk '{print $3}'`; do
for POOLMEMBER in `tmsh list ltm pool $POOLNAME | grep : | sort | awk '{print $1}'`; do
echo \"$POOLNAME/$POOLMEMBER\", >> /var/class/pool_member_status_list.class
done
done
if [ "`cat /var/prompt/ps1`" == "Active" ]; then
tmsh load sys config
fi
exit 0
13 Replies
- JRahm
Admin
you can do that natively in iRules with the members command and LB::status (example in the members wiki entry.) Of course if you want to dynamically discover new pools, would still need the script for that part.
Your script above is populating the class file properly on my test system:
"error_free_pool/192.168.101.10:80", "lp1/192.168.101.20:514", "lp2/192.168.101.21:514", "lp3/192.168.101.22:514", "testpool/192.168.101.10:80", "testpool_alt/192.168.101.22:80",Might look to the iRule to make sure the slicing and dicing of that data is working properly.
- Jim_Moore
Nimbostratus
Jason thanks for looking at this. I am using the LB::status but I'm thinking there is a parsing difference with the way the b command and the tmsh command is presenting the data.
Below is the iRule snip referencing the LB:status.
Generate the status page with either all content or content from a single pool.if { ([HTTP::uri] eq "/status") || (([HTTP::uri] starts_with "/status?") && ($query) && [info exists manualpool]) } { set timestamp "[clock format [clock seconds]]" set response "StatusPool NameMemberPort" set count 0 foreach { selectedpool } [class get pool_member_status_list] { set display 1 if { [catch { scan $selectedpool {%[^/]/%[^:]:%s} poolname addr port switch -glob [LB::status pool $poolname member $addr $port] { - JRahm
Admin
looks like the scan is expecting the data string to be without the quotes:
% set x {"lp1/192.168.101.20:514",} "lp1/192.168.101.20:514" % scan $x {%[^/]/%[^:]:%s} poolname addr port 3 % puts $poolname "lp1 **wrong!** % puts $addr 192.168.101.20 % puts $port 514", **wrong!**so you can either change the bash script to not echo the quotes (best) for each pool/ip/port, or string them off before passing to scan (see below), or update the scan command to account for them.
% set x {"lp1/192.168.101.20:514",} "lp1/192.168.101.20:514", % scan [string range $x 1 end-2] {%[^/]/%[^:]:%s} poolname addr port 3 % puts $poolname lp1 % puts $addr 192.168.101.20 % puts $port 514 - Jim_Moore
Nimbostratus
Jason I remove the quotes from the echo but I'm still getting INVALID status.
!/bin/bash
tmsh modify sys db bigpipe.displayservicenames value false
rm -f /var/class/pool_member_status_list.class
for POOLNAME in
; dotmsh list ltm pool | grep -i "ltm pool" | sort | awk '{print $3}'for POOLMEMBER in
; dotmsh list ltm pool $POOLNAME | grep : | sort | awk '{print $1}'echo "$POOLNAME/$POOLMEMBER", >> /var/class/pool_member_status_list.classdone
done
if [ "
" == "Active" ]; thencat /var/prompt/ps1tmsh load sys config
fi
exit 0
Contents of class file below
[root@nc93q-lb-st-dcds2:Active] class cat pool_member_status_list.class fapdamail10_nc/172.17.188.30:http, fapdamail10_nc/172.17.188.31:http, fapdamail10_nc/172.17.188.32:http, lync2013fe_nc/172.17.188.44:any, mailsearch_nc/172.17.188.32:any, oncallmail_nc/172.17.188.33:any, owa2-as_nc/172.17.188.30:https, owa2-as_nc/172.17.188.31:https, owa2_nc/172.17.188.30:any, owa2_nc/172.17.188.31:any, owa2_nc/172.17.188.32:any, pdainternal_nc/172.17.188.30:http, pdainternal_nc/172.17.188.31:http,
- JRahm
Admin
oh, you're still using the services names instead of the port numbers. That tmsh command should do the trick, but looks like it is not.
- Jim_Moore
Nimbostratus
Yeah I just tested that. Manually changed the class file to the ports and it worked. Any idea why the tmsh modify sys db bigpipe.displayservicenames value false wouldn't work?
- JRahm
Admin
what is the default value on your version? It's false on mine.
[root@ltm1:Active:Standalone] tmp tmsh list sys db bigpipe.displayservicenames sys db bigpipe.displayservicenames { value "false" } - Jim_Moore
Nimbostratus
I'm running 10.2.4 in my test environment. Looks like this is a bug.
SOL13624
We are getting ready to upgrade to version 11 so it should work after that.
Thanks for all your help
- JRahm
Admin
no worries, check back if after the upgrade you need some help! BTW..wrt to upgrade from 10.x to 11.x, HA changes quite a bit, make sure you read up.
- Jim_Moore
Nimbostratus
Finally getting around to upgrading to version 11.5.1 I'm testing out the pool status page. After figuring out the data group differences in v11 I've got it working. The only issue is the web page does not display the information alphabetically. The class file is populated alphabetically but the web page is random. Any idea why? I'm using the same irule as below:
https://devcentral.f5.com/wiki/iRules.Pool__Member__Status__Page_on_a__Virtual__Server_v10.ashx
- Jim, see https://devcentral.f5.com/s/feed/0D51T00006i7RDmSAM - basically you want 'lsort'.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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