Forum Discussion
Get actual IP address from a poolmember in Powershell
I'm using powershell to query pool members. I'm able to pull the address and port form get_member_v2, but address is not actually IP address, but Node Name. How can I get the actual IP address for a pool member.
Here's the script I'm working with
$stream = [System.IO.StreamWriter] "poolsandmembers.csv"
$poollist = (Get-F5.iControl).LocalLBPool.get_list();
$stream.WriteLine("pool,address,port");
foreach ($pool in $poollist)
{
$members = Get-PoolMembers -Pool $pool;
foreach ($member in $members) {
$stream.WriteLine($pool+","+$member.address+","+$member.port);
}
}
$stream.close()
function Get-PoolMembers()
{
param(
$Pool = $null
);
$MemberListAofA = (Get-F5.iControl).LocalLBPool.get_member_v2( @($Pool) );
$MemberListA = $MemberListAofA[0];
$MemberListA;
}
3 Replies
- Brent_West_7733Historic F5 AccountTake the output from your pool member query and feed it into this: https://devcentral.f5.com/wiki/iControl.LocalLB__NodeAddressV2__get_address.ashx
- Faintly_Lucky
Nimbostratus
For a short term fix, you can use the deprecated get_member method. It will return the IP addresses of the members. Note that I don't name nodes in V11, so your mileage with that may vary. - AJ_2559
Nimbostratus
Thanks!. Here's what I ended up doing. I made a function called Get-PoolMemberIP:
function Get-PoolMemberIP() { param( $Member = $null ); $MemberIP = (Get-F5.iControl).LocalLBNodeAddressV2.get_address( @($Member) ); $MemberIP; }Then I call that and set it to a variable in my foreach members loop
foreach ($member in $members) { $memberipadd = Get-PoolMemberIP -Member $member.address; $stream.WriteLine($pool+","+$member.address+","+$memberipadd+","+$member.port); }
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