Forum Discussion
List poolmembers that are down,unavailable and Unknown
Hi, Im writing a simple GUI in powershell studio that displays poolmember status. I'm having difficulties writing conditional logic so that the application only list poolmembers that are not available. I've looked at Joe's 'LocalTrafficSummary.ps1' but i want to know which poolmembers that are offline, disabled etc.
$pools = Get-F5.LTMPool | Select -ExpandProperty Name
$poolmembers = foreach($pool in $pools) { Get-F5.LTMPoolMember -Pool $pool }
This seems to work bu if i want to include Unavailable and Unknown, how do i write that code? $poolmembers | Where-Object {$_.Availability -eq 'AVAILABILITY_STATUS_RED'}
thanks!
4 Replies
- cjunior
Nacreous
So, if you look for any others with "-ne"?? $poolmembers | Where-Object {$_.Availability -ne 'AVAILABILITY_STATUS_GREEN'} - cjunior
Nacreous
Since you are using the value of "Availability", you can do the following: add the operator "-or" like:
$poolmembers | Where-Object {$_.Availability -eq 'AVAILABILITY_STATUS_RED' -or $_.Availability -eq 'AVAILABILITY_STATUS_BLUE'}
or just filter any different like: $poolmembers | Where-Object {$_.Availability -ne 'AVAILABILITY_STATUS_GREEN'}
Is this what you want?
- Martin_B__246_r
Nimbostratus
Hi, yes i tried that, is this the best way? All i sant To dom is display pools & poolmembers that are not available.
- cjunior
Nacreous
Well, I'm not expert, but, if you will store only members that are not in "available green status", maybe I would made the filter on the same command line. I think you are on the correct way.
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