Forum Discussion
Azam89_157500
Nimbostratus
Jan 04, 2015Command or query to pull the membership of node in multiple pools
We have nodes which are part of multiple pools. Is there a way to query if i give the ip/node name to list the pools the node is member of ?
Michael_Jenkins
Cirrostratus
Jan 05, 2015Here's some code that may help for PowerShell iControl... Just replace the server address with the right ip/hostname and update the nodeToFind variable. It's a little wordy, but I think it'll accomplish what you're looking for. (Could be wrapped as a function as well to make it easier)
Connect to the BIG-IP
$creds = Get-Credential;
$server = "0.0.0.0";
$iConn = Initialize-F5.iControl -HostName $server -Username $creds.Username -Password $creds.GetNetworkCredential().Password;
$iCtrl = Get-F5.iControl;
Get Node Information
$nodeNames = @($ictrl.LocalLBNodeAddressV2.get_list());
$nodeAddress = @($ictrl.LocalLBNodeAddressV2.get_address($nodeNames));
$nodeList = @();
for ($i=0; $i -le $nodeNames.Length; $i++) {
$nodeList += "" | Select-Object @{Name="Name"; Expression={$nodeNames[$i]}}, @{Name="Address";Expression={$nodeAddress[$i]}}
}
Get Pool Information
$poolNames = @($ictrl.LocalLBPool.get_list());
$poolMembers = @($ictrl.LocalLBPool.get_member_v2($poolNames));
$poolList = @();
for ($i=0; $i -le $poolNames.Length; $i++) {
$poolList += "" | Select-Object @{Name="Name"; Expression={$poolNames[$i]}}, @{Name="Members";Expression={@($poolMembers[$i])}}
}
Node to find
$nodeToFind = "10.0.1.1"; or "google.com"
$node = $nodeList | ?{ $_.Name -like "*$nodeToFind" -or $_.Address -like $nodeToFind };
Get associated pools
$poolList | ?{ $_.Members | ?{ $_.address -eq $node.Name } }
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