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?
13 Replies
- NzYme_68513
Nimbostratus
preferably using the powershell iControl cmdlets? So far I'm not seeing anything that would give that type of insight into the pool objects. - snovakov_86258
Nimbostratus
Don't know about any PowerShell iControl cmdlets, but looking at iControl v10.0.0 SDK I see the method: - NzYme_68513
Nimbostratus
Getting closer. I'm using this code below but it's still coming up with an error. I suspect the parameters I'm passing are insufficient or in the wrong format. - snovakov_86258
Nimbostratus
Can you post the error you are receiving? - NzYme_68513
Nimbostratus
Looking under get_statistics after running a get-member on the object $F5.LocalLBPoolMember I see: - The get_statistics method takes 2 parameters, the first is an array of pool names, the second is a 2-d array of pool members (a 1-d array for each of the pools specified in the first parameter. I wrote a tech tip a while back that included that method. Check it out and let me know if it works for you.
- NzYme_68513
Nimbostratus
Ok I got by that part after reading that tech tip but what's the syntax to grab the stats? I have the code like this: - snovakov_86258
Nimbostratus
Joe would know better than me on this, but it seems you might be able to simply dump the '$stats' variable to the screen or to a log to see what it looks like and then figure out how to access the items in it you are looking for. - NzYme_68513
Nimbostratus
When I output $stats to the screen I get this: - 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; }
$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); }
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