Forum Discussion
The get_member_statistics method looks like this:
LocalLB.Pool.MemberStatistics [][]
LocalLB.Pool.get_member_statistics(
String [] pool_names,
Common.AddressPort [][] members
);
the first parameter in your call looks good, but for the second you are just passing in a Common.AddressPort literal (not a 2-d array). The reason for the arrays is so you can pass in multiple pools with different members for each pool request. The first dimension of the 2-d array is for the associated pool in the first parameter and the 2nd dimension holds the list of members for that given pool. Think of it like requesting this
Pool1
member1
member2
member3
Pool2
member4
member5
The first parameter would be a 1-d array containing two pool names of "Pool1" and "Pool2".
The second parameter would contain a 2-d array looking something like this
pool_members[0] = "Pool1"
pool_members[1] = "Pool2"
members[0][0] = member1
members[0][1] = member2
members[0][2] = member3
members[1][0] = member4
members[1][1] = member5
So, getting back to your code. If you just have a single pool with a single member for that pool, it would look like this
pool_names[0] = $pool_name;
members[0][0] = $address;
Now, here's how you would do it in PowerShell
1-d array of pool names
$poolnamesA = @($pool_name);
2-d array of Common.AddressPorts
$address = New-Object -TypeName iControl.CommonAddressPort;
$address.address =$member_name;
$address.port = $member_port;
$membersA = @($address);
$membersAofA = @($membersA);
$MemberStatisticsAofA = (Get-F5.iControl).LocalLBPool.get_member_statistics(
$poolnamesA, $membersAofA);
Loop over pools. There will only be one here
foreach($MemberStatisticsA in $MemberStatisticsAofA) {
Loop over each member for current pool (again, only one here)
foreach($MemberStatistics in $MemberStatisticsA) {
print out results
}
}
This code isn't tested, so hopefully it runs, but it should get you pointed in the right direction...
-Joe