Forum Discussion

VFB's avatar
Icon for Cirrus rankCirrus
Nov 29, 2023

remove a node from multiple pools using bash

I have a node that I would like to delete from multiple pools that is running on different ports. I tried the command below, and while it removes some, I noticed it doesn't delete the members that are in offline or disabled mode. Any help would be grateful. 

node=""; tmsh list ltm pool one-line | grep -E "${node}:[[:alnum:]]" | \
sed -r 's/ltm pool ([^ ]+).*members.*('${node}':[[:alnum:]]+).*/tmsh modify ltm pool \1 members delete { \2 }/g' | bash -x

6 Replies

  • VFB Would you mind sharing what your output looks like when you run just the following from tmsh?

    list ltm pool one-line | grep ""


    • VFB's avatar
      Icon for Cirrus rankCirrus

      The output shows all the pools with the associated member. 

      • VFB Yes, I do realize what the output should be but I'm looking for what it is for you to ensure that what you have command wise will work or we can figure out why it doesn't work. Ideally I would like to see two of the lines, one with all pool members active/working and one with some down/disabled pool members.