Forum Discussion
Pool names from associated node address
Hi All,
I have some nodes those are member of many pools. I want to fetch all pool names from associated node address. Please guide which icontrol interface should I use ? I couldn't find anything appropriate in LocalLB::Pool.(version 11.4.0) Thanks in advance.
br, rohan
4 Replies
- Hamish
Cirrocumulus
You have to scan through the pools, grab their pool members and match what you're looking for.
There's no way to pull a list of pools for a given pool member. (That I know of anyway).
Which language do you use?
/Patrik
If you're using powershell you can try this:
Initialize Snapin if ( (Get-PSSnapin | Where-Object { $_.Name -eq "iControlSnapIn"}) -eq $null ){ Add-PSSnapIn iControlSnapIn } Add a custom class with properties matching the object you got before Add-Type @' public class Member { public string Pool; public string Address; public string Port; public string Name; public string Availability; public string Enabled; public string Status; } '@ Function Get-Pool-Members { Param([string]$BigIP, [string]$User, [string]$Password, [string]$Partition="Common") Declare variables $ObjMembers = @() $NodeDict = @{} Connect to the BigIP $Success = Initialize-F5.iControl -HostName $BigIP -Username $User -Password $Password Get an iControl Handle $F5 = Get-F5.iControl Change Partition $F5.ManagementPartition.set_active_partition($Partition) Get Pool Lists, statuses, nodes etc $PoolList = $f5.LocalLBPool.get_list() $Poolmembers = $f5.LocalLBPool.get_member_v2($PoolList) $PoolMemberstatuses = $F5.LocalLBPool.get_member_object_status($PoolList, $Poolmembers) $NodeList = $F5.LocalLBNodeAddressV2.get_list() $NodeIPList = $f5.LocalLBNodeAddressV2.get_address($NodeList) Save the nodes in a dictionary for convenient access for($i=0;$i -lt ($NodeList.Count);$i++){ $NodeDict.Add($NodeList[$i], $NodeIPList[$i]) } for($i=0;$i -lt ($PoolList.Count);$i++){ for($x=0;$x -lt ($PoolMembers[$i].Count);$x++){ Create a new temporary object of the member class $objTempMember = New-Object Member Populate the object $objTempMember.Pool = $PoolList[$i] $objTempMember.name = $PoolMembers[$i][$x].address $objTempMember.Address = $NodeDict[$objTempMember.name] $objTempMember.Port = $PoolMembers[$i][$x].port $objTempMember.Availability = $PoolMemberstatuses[$i][$x].availability_status $objTempMember.Enabled = $PoolMemberstatuses[$i][$x].enabled_status $objTempMember.Status = $PoolMemberstatuses[$i][$x].status_description Add the object to a list $ObjMembers += $objTempMember } } Return the object list Return $ObjMembers } $poolmembers = Get-Pool-Members -BigIP "10.10.10.1" -User "User" -Password "Password" -Partition "Common" $poolmembers | where-object { $_.name -eq "/Common/Poolname" } | select PoolThere's some additional information in $poolmembers that you don't really need, but that's how I'd do it.
/Patrik
It's not that hard once you get into it. Install the powershell snapin available here at devcentral and try it out? :)
Kind regards, Patrik
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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