Forum Discussion
External class and class command
The problem is that, my output will only show the last member of each pool. For example, if there are three entries in the class like shown below, the iRule will only output the last. So if there are 10 pools, all with 3 members, I will only get 10 entries in the output rather than 30. Additionally, when I check the size of the class using class size class_name, I would get 10 as the return value.
"test_http-pool" := "1.1.1.1:http",
"test_http-pool" := "2.2.2.2:http",
"test_http-pool" := "3.3.3.3:http",
Here is the cron change I made to query for all pools all members and write out the class file:
b pool all member all | grep POOL | awk '{print "\""$3"\","}' | sed -e 's/\//\" \:\= \"/g' | sort >/var/class/pool_member_status_list.class
Is the problem in using duplicates of a single name even when each of their value pairings are unique?
Here are the main changes to the iRule:
when HTTP_REQUEST {
...
...
for {set i 0} {$i < [class size pool_member_status_list]} {incr i} {
if { [catch {
set poolname [class element -name $i pool_member_status_list]
set addrport [class element -value $i pool_member_status_list]
scan [split $addrport ":"] %s%s addr port
switch -glob [LB::status node $addr] {
...
...
}
} errmsg] } {
...
...
}
}
}
Thanks in advance for any assistance, and for providing a great resource!
Anthony
- hoolio
Cirrostratus
Hi Anthony, - Anthony_Hatch_3
Nimbostratus
Thanks for the response Aaron! This works as I intended and outputs correctly. The problem isn't actually with that command, but with how the class commands are processing the contents of the class file that is output from that command. I was actually just in the process of posting an update when you replied. üôÇ"test_http-pool_1" := "1.1.1.1:http", "test_http-pool_2" := "2.2.2.2:http", "test_http-pool_3" := "3.3.3.3:http",
- Anthony_Hatch_3
Nimbostratus
I just realized something that I had completely missed before. I could probably cut out much of the code from the iRule by not using the switch statements to test against the result of the LB::status commands for each pool member. I hadn't noticed that the b pool all member all command actually gives the status of the pool member. So if I change up how the class file gets written when the cron job is run, I can get the pool name, pool member, service port, and status all at once and just use the iRule to parse the data out properly. An an example of the command to get the output would now look like: - Anthony_Hatch_3
Nimbostratus
My initial testing looks good. I no longer run into any issues relating to the size of the class. - Anthony_Hatch_3
Nimbostratus
I guess I should have done some more research into some of the things I was trying to do. Hadn't even noticed this great article Click Here! - Colin_Walker_12Historic F5 AccountI'm glad to see you found a solution. Let us know if you've got any more questions.
- gpoverland
Nimbostratus
Very nicely done folks. Trying to look at the pool members that are displayed and display them as their DNS name or possibly editing the code to display only the last two octets (if IP)? Have any ideas? I'm not very handy with the awk command, so any help would be appreciated... Thanks
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