Forum Discussion

mariana_kirova_'s avatar
mariana_kirova_
Icon for Nimbostratus rankNimbostratus
Dec 10, 2018

list pools by name

Hello, how can I list the names of all pools containing let's say "qa" in their name. Thanks!

 

16 Replies

  • This script handles multiple partitions and can have it's output piped to a file for further analysis:

    tmsh -q -c 'cd /;show running-config recursive'|awk '/^ltm pool /{capture=1}/^}$/{if (capture==1) {print; capture=0} else {next}}capture' | grep 'ltm pool\|monitor '
    

    You can also run it against an SCF file, by removing the initial tmsh clause and providing the awk expression with an scf file to read.

  • I found following in previously asked questions but doesn't seem to work for me:

     

    (tmos)list ltm pool all | grep 'ltm pool|qa'

     

  • From the command line, this works as well if you just want the names of the pools:

    tmsh list ltm pool | grep "qa" | gawk '{print $3}'

    The following will list out all of the pool names on your system:

    tmsh list ltm pool | grep "ltm pool" | gawk '{print $3}'

    • gdoyle's avatar
      gdoyle
      Icon for Cirrostratus rankCirrostratus

      The

      gawk
      command doesn't seem to work for my (I received the following:
      Syntax Error: "gawk", grep is currently the only filter that is supported
      ).

      Also, if you have multiple partitions you will have to change your directory into the relevant partition. There may be a way to do a global search for all partitions, but I don't know that off hand.

    • AceDawg1's avatar
      AceDawg1
      Icon for Nimbostratus rankNimbostratus

      Gawk can be executed if you are not in the tmsh shell. You have to be in the bash shell.

       

      For partition support, use:

       

      tmsh list ltm pool /partition/* | grep “ltm pool” | gawk ‘{print $3}’

       

  • From the command line, this works as well if you just want the names of the pools:

    tmsh list ltm pool | grep "qa" | gawk '{print $3}'

    The following will list out all of the pool names on your system:

    tmsh list ltm pool | grep "ltm pool" | gawk '{print $3}'

    • gdoyle's avatar
      gdoyle
      Icon for Cirrostratus rankCirrostratus

      The

      gawk
      command doesn't seem to work for my (I received the following:
      Syntax Error: "gawk", grep is currently the only filter that is supported
      ).

      Also, if you have multiple partitions you will have to change your directory into the relevant partition. There may be a way to do a global search for all partitions, but I don't know that off hand.

    • AceDawg_204810's avatar
      AceDawg_204810
      Icon for Cirrus rankCirrus

      Gawk can be executed if you are not in the tmsh shell. You have to be in the bash shell.

       

      For partition support, use:

       

      tmsh list ltm pool /partition/* | grep “ltm pool” | gawk ‘{print $3}’

       

  • From tmsh:

    For pools on the default partition (/Common):

    list ltm pool | grep qa

    For pools on all other partitions:

    list ltm pool /*/* | grep qa

    • mariana_kirova_'s avatar
      mariana_kirova_
      Icon for Nimbostratus rankNimbostratus

      tmsh list ltm pool | grep "ltm pool" | gawk '{print $3}'
      works great, thanks!

      This one however doesn't work well when I am matching something that is part of the pool's settings (for example "user" is being matched by

      session user-disabled
      ) so it will display all my pools:

      (tmos) list ltm pool | grep user

      Display all 1253 items? (y/n) n

    • wlopez_98779's avatar
      wlopez_98779
      Icon for Nimbostratus rankNimbostratus

      This would give you all the properties for all pools and filter for only the lines that include the pool names and the lines where the string 'user' shows up in the configuration.

      From tmsh:

      For pools on the default partition (/Common):

      list ltm pool all-properties | grep 'ltm pool\|user'
      

      For pools on all other partitions:

      list ltm pool /*/* all-properties | grep 'ltm pool\|user'
      
  • wlopez's avatar
    wlopez
    Icon for Cirrocumulus rankCirrocumulus

    From tmsh:

    For pools on the default partition (/Common):

    list ltm pool | grep qa

    For pools on all other partitions:

    list ltm pool /*/* | grep qa

    • mariana_kirova_'s avatar
      mariana_kirova_
      Icon for Nimbostratus rankNimbostratus

      tmsh list ltm pool | grep "ltm pool" | gawk '{print $3}'
      works great, thanks!

      This one however doesn't work well when I am matching something that is part of the pool's settings (for example "user" is being matched by

      session user-disabled
      ) so it will display all my pools:

      (tmos) list ltm pool | grep user

      Display all 1253 items? (y/n) n

    • wlopez's avatar
      wlopez
      Icon for Cirrocumulus rankCirrocumulus

      This would give you all the properties for all pools and filter for only the lines that include the pool names and the lines where the string 'user' shows up in the configuration.

      From tmsh:

      For pools on the default partition (/Common):

      list ltm pool all-properties | grep 'ltm pool\|user'
      

      For pools on all other partitions:

      list ltm pool /*/* all-properties | grep 'ltm pool\|user'
      
  • You can also use the sed command to get the info directly from the bigip.conf files of the different partitions.

    Try the below command

    sed -n '/^ltm pool/p' /config/bigip.conf /config/partitions/*/bigip.conf | awk '{ print $3 }'