Search for pools with no members

HI everyone, hope you are all doing well!

We currently have a cleanup script that runs monthly that looks for pools with no members in DNS, removes them, deletes the pools, then delete the VIP. My colleague was able to get the removal of the nodes from the pool, but I am seeing that the script is not picking up the “empty” pools with no members. I would like to figure out how to find pools with no members in there (count of 0) so the script can pick it up and delete it.

I found the following commands, but this still shows pools with “downed” members

Started with this:

tmsh show ltm pool field-fmt | grep -E “ltm pool|available-members 0” --after-context 1 | grep -v ‘total-members’

refined it to no-members

tmsh show ltm pool field-fmt | grep -E “ltm pool|available-members 0” --after-context 1 | grep -v ‘no-members’

But it is still showing me pools with with members. I am sorta new to this and running out of ideas! If anyone could help, that would be great! Thanks

Hey,
You can use the following command to show the pools without members
tmsh show ltm pool field-fmt | grep -B 2 “available-member-cnt 0” | grep “ltm pool”

you can tweak it to your needs

you should chekc which line the available-member-cnt is at and change the -B if needed

Thank you for your feedback!

Using that, i was still able to pull pools with members in the pool.

Walking this backwards, I think I need to find the “total members” and queue my search on that. The available members or min active will show pools with members for whatever reason.

Using your search, here is a pool with a member in the pool

Ltm::Pool: pzentws.dev.cardinalhealth.net-tcp7443-pool
---------------------------------------------------------------------------------------
Status
  Availability           : offline
  State                  : enabled
  Reason                 : The children pool member(s) are down
  Monitor                : https-cah-default
  Minimum Active Members : 0
  Priority Groups        : 0/0/0 (highest/current/lowest)
  Current Active Members : 0
  Available Members      : 0
  Total Members          : 1
  Total Requests         : 0
  Current Sessions       : 0

Pools with no members.

Ltm::Pool: ecm3pl.qa.cardinalhealth.net-tcp3212-pool
---------------------------------------------------------------------------------------
Status
  Availability           : offline
  State                  : enabled
  Reason                 :
  Monitor                : tcp-cah-default
  Minimum Active Members : 0
  Priority Groups        : 0/0/0 (highest/current/lowest)
  Current Active Members : 0
  Available Members      : 0
  Total Members          : 0
  Total Requests         : 0
  Current Sessions       : 0

Yeah seems like the issue,
We went with available-members but seems like Total Members are more accurate
adding new command you can run
tmsh show ltm pool | grep -B 11 “Total Members          : 0”  | grep “Ltm::Pool”

please know you will need to update the exact spacing you have in the Total Members to the actual number added how it showed up on mine cli

Thank you! That did the trick! :slight_smile:

I was getting close yesterday but was still getting mixed results.