Forum Discussion
Need help in finding pools with only only one pool member
Hello,
I need help in finding pools with only only one pool member. Please let me know if this can be done via any command or script.
I would start with:
From cil - in bash...
tmsh list ltm pool all members
and start my filter with
tmsh list ltm pool all members |egrep 'ltm pool|address'
if you dont need/use ipv6
tmsh list ltm pool all members |egrep 'ltm pool|address' |egrep -v 'any6'
that should get you close
You can achieve this using a simple bash script. For example:
# Author: Michael Saleem # Filename: f5-list-pools-based-on-member-quantity.sh # Purpose: This script will list all pools containing a specified number of pool members #!/bin/bash POOL_MEMBER_QUANTITY=1 POOLS=$(tmsh list ltm pool one-line | awk '{print $3}') for POOL in $POOLS; do POOL_MEMBER_COUNT=$(tmsh list ltm pool $POOL one-line | awk -F':' '{print NF -1}';) if [ "$POOL_MEMBER_COUNT" = "$POOL_MEMBER_QUANTITY" ] then echo $POOL fi done
I would start with:
From cil - in bash...
tmsh list ltm pool all members
and start my filter with
tmsh list ltm pool all members |egrep 'ltm pool|address'
if you dont need/use ipv6
tmsh list ltm pool all members |egrep 'ltm pool|address' |egrep -v 'any6'
that should get you close
- Shoaib_020Altostratus
Hello,
I am getting error as below:
Syntax Error: "egrep", grep is currently the only filter that is supported
need to be in bash for egrep to work -
the line also includes "tmsh" as a precurser - execute the command in that shell.
You can achieve this using a simple bash script. For example:
# Author: Michael Saleem # Filename: f5-list-pools-based-on-member-quantity.sh # Purpose: This script will list all pools containing a specified number of pool members #!/bin/bash POOL_MEMBER_QUANTITY=1 POOLS=$(tmsh list ltm pool one-line | awk '{print $3}') for POOL in $POOLS; do POOL_MEMBER_COUNT=$(tmsh list ltm pool $POOL one-line | awk -F':' '{print NF -1}';) if [ "$POOL_MEMBER_COUNT" = "$POOL_MEMBER_QUANTITY" ] then echo $POOL fi done
- Shoaib_020Altostratus
Thank you very much for the script.
Hi Shoaib,
I always use the following command in TMSH mode if writing or executing shell scripts are not allowed in client environments:
show ltm virtual all-properties detail | grep -i -e 'LTM\|Destination'
Copy all the output in excel heet and conver the TEXT to COLUMN feature , it will give the details of all the pools and from there you can find the pools with 1 members. maybe not exactly what you are looking for but it helps in many ways .
HTH
🙏
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