Forum Discussion
Ray_Morris_7896
Nimbostratus
Aug 02, 2006get_member_statistics example
Hello,
The SDK gives good examples of how to use ITCMLocalLBPool, but there is no example for the gathering of statistics for pool members (it only shows pool stats and I can find no other references in the forums). I'm looking for an example of how to use get_member_statistics for my pool members.
I'm confused about what parameters to pass on (ie: pool.get_member_statistics(???))
I am new to developing, and therefore can't backtrack my way into the correct answer.
Thank you for your time.
3 Replies
- Do you need to request a specific pool member to get the statistics on? It is probabaly easier to use the ITCMLocalLB::Pool::get_all_member_statistics() that takes as input a pool name and will return a list of all MemberStatisticEntry structures with the member's IPPortDefinition as well as the statistics.
This isn't tested but it should get you started.$soapResponse = $Pool->get_all_member_statistics( SOAP::Data->name(pool_name => "my_pool") ); @MemberStatisticsEntryList = @{$soapResponse}; print "Pool my_pool\n"; foreach $MemberStatisticEntry (@MemberStatisticsEntryList) { $IPPortDefinition = $MemberStatisticsEntry->{"member_definition"} $addr = $IPPortDefinition->{"address"}; $port = $IPPortDefinition->{"port"}; print " member: $addr:$port\n"; $stats = $MemberStatisticsEntry->{"stats"}; $thruput_stats = $stats->{"thruput_stats"}; $bits_in = $thruput_stats->{"bits_in"}; ... print " bits_in: $bits_in\n"; $connection_stats = $stats->{"connection_stats"}; $current_connections = $connection_stats->{"current_connections"}; ... print " cur_con: $current_connections\n"; }
If you need to use the get_member_statistics() method, you'll have to build up an array of structures containing address and values$IPPortDefinition = { address => "10.10.10.10", port => 80 }; push @MemberDefList, $IPPortDefinition $soapResponse = $Pool->get_member_statistics( SOAP::Data->name(pool_name => "my_pool"), SOAP::Data->name(member_defs => [@MemberDefList]) ); ...
Hope this helps...
-Joe - Ray_Morris_7896
Nimbostratus
Thanks Joe,
I should have mentioned that I'm using C (your code looks a bit foreign...)
I was able to use your suggestion and come up with this piece (which is nested inside another loop):Pool.ITCMLocalLBPoolMemberStatisticsEntry [] memstats = LocalLBPool.get_all_member_statistics(pool_name); for(int j=0; j{ string memAddr = memstats[j].member_definition.address; trow = new TableRow(); tcell = new TableCell(); tcell.Controls.Add(new LiteralControl(memAddr.ToString())); trow.Cells.Add(tcell); Table1.Rows.Add(trow); }
This code will compile without error, but when I call it in the browser, I get an error that the "Object reference not set to an instance of an object." Any suggestions?
I'm much closer than I was. Thanks for your help. - Ray_Morris_7896
Nimbostratus
I fixed it. I had my syntax wrong in setting up LocalLBPool. It should have been:Pool.ITCMLocalLBPool LocalLBPool = new Pool.ITCMLocalLBPool();
It's working fine now.
Thanks again.
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