Forum Discussion
NzYme_68513
Nimbostratus
Jul 10, 2012Pool connection stats?
Is there a way to pull the current and maximum connections on a pool via iControl?
Jul 11, 2012
The returned value from the PoolMember.get_statistics() method is a 1-D array of MemberStatistics structures.
MemberStatistics [] PoolMember.get_statistics(
String [] pool_names,
Common.IPPortDefinition [][] members
);
struct MemberStatistics {
MemberStatisticEntry [] statistics
TimeStamp time_stamp
};
struct MemberStatisticEntry {
IPPortDefinition member;
Statistic statistics;
};
struct Statistic {
StatisticType type;
ULong64 value;
long time_stamp;
}When calling the method, you pass in a 1-d array of pool names and a 2-d array of member definitions (an array for each of the pools passed in).
To parse the results, you need to iterate through the returned value arrays
$MemberStatisticsA = (Get-F5.iControl).LocalLBPool.get_statistics(...);
Iterate through each pool
foreach($MemberStatistics in $MemberStatisticsA)
{
$MemberStatisticEntryA = $MemberStatistics.statistics;
Iterate through each pool members statistics for the current pool
foreach($MemberStatisticEntry in $MemberStatisticEntryA)
{
$IPPortDef = $MemberStatisticEntry.member;
$member_addr = $IPPortDef.address;
$member_port = $IPPortDef.port;
$StatisticsA = $MemberStatisticEntry.statistics;
foreach($Statistic in $StatisticsA)
{
$Type = $Statistic.type;
$value = $Statistic.value;
$v_high = $Statistic.high;
$v_low = $Statistic.low;
Need to convert low and high 32-bit values to a 64-bit number
$v_64 = Convert-To64Bit $v_high $v_low;
Write-Host "${Type} : $v_64";
}
}
}
function Convert-To64Bit()
{
param($high, $low);
$low = [Convert]::ToString($low,2).PadLeft(32,'0')
if($low.length -eq "64") { $low = $low.substring(32,32) }
return [Convert]::ToUint64([Convert]::ToString($high,2).PadLeft(32,'0')+$low,2);
}*NOTE, I just whipped this up and it hasn't been tested. Hopefully I didn't have any typos but it should illustrate the logic.
BTW, The tech tip I referenced shows how to pull out the values from the returned statistics array.
Hope this helps...
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
