# get\_member\_statistics example

**URL:** <https://community.f5.com/t/get-member-statistics-example/33930>\
**Category:** Technical Forums\
**Tags:** icontrol, dev, v4, devops\
**Created:** [August 2, 2006, 9:09pm UTC](https://community.f5.com/t/get-member-statistics-example/33930 "2006-08-02T21:09:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ray\_Morris\_7896](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@Ray\_Morris\_7896](https://community.f5.com/u/Ray_Morris_7896)\
**Post date:** [August 2, 2006, 9:09pm UTC](https://community.f5.com/t/get-member-statistics-example/33930/1 "2006-08-02T21:09:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Joe\_Pruitt](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/joe_pruitt/32/8438_2.png) [@Joe\_Pruitt](https://community.f5.com/u/Joe_Pruitt)\
**Post date:** [August 2, 2006, 11:35pm UTC](https://community.f5.com/t/get-member-statistics-example/33930/2 "2006-08-02T23:35:15Z")

</div>

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.

```tcl
$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

```tcl
$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

---

<div class="post-metadata">

**Author:** ![Ray\_Morris\_7896](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@Ray\_Morris\_7896](https://community.f5.com/u/Ray_Morris_7896)\
**Post date:** [August 3, 2006, 2:00pm UTC](https://community.f5.com/t/get-member-statistics-example/33930/3 "2006-08-03T14:00:14Z")

</div>

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):

```tcl
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.

---

<div class="post-metadata">

**Author:** ![Ray\_Morris\_7896](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@Ray\_Morris\_7896](https://community.f5.com/u/Ray_Morris_7896)\
**Post date:** [August 3, 2006, 3:20pm UTC](https://community.f5.com/t/get-member-statistics-example/33930/4 "2006-08-03T15:20:05Z")

</div>

I fixed it. I had my syntax wrong in setting up LocalLBPool. It should have been:

```tcl
Pool.ITCMLocalLBPool LocalLBPool = new Pool.ITCMLocalLBPool();

```

It’s working fine now.

Thanks again.
