Forum Discussion
PS script to display member states of all pools?
All of the methods take arrays as parameters. So, let's say you want to get the object status for all members of all pools, you could do something like this:
$pool_list = (Get-F5.iControl).LocalLBPool.get_list();
$MemberObjectStatusAofA = (Get-F5.iControl).LocalLBPoolMember.get_object_status($pool_list);
The returned value in $MemberObjectAofA will be a 2-d Array. The first dimension associating with the pools. The second dimension would be the members for that given pool.
for($i=0; $i -lt $pool_list.Length; $i++)
{
$pool = $pool_list[$i];
$MemberObjectStatusA = $MemberObjectStatusAofA[$i]
Write-Host "POOL '$pool':";
for($j=0; $j -lt $MemberObjectStatusA.Length; $j++)
{
$MemberObjectStatus = $MemberObjectStatusA[$j];
$member = $MemberObjectStatus.member;
$member_ip = $member.address;
$member_port = $member.port
$ObjectStatus = $MemberObjectStatus.object_status;
$availability = $ObjectStatus.availability_status;
$enabled = $ObjectStatus.enabled_status;
$description = $ObjectStatus.description;
Write-Host " + ${member_ip}:${member_port} -> $availability, $enabled, $description";
}
}
Warning, this isn't tested, but it should be close...
Hope this helps!
-Joe
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