Forum Discussion

Thiyagu's avatar
Thiyagu
Icon for Cirrus rankCirrus
Apr 26, 2021

F5 LTM command options to get the name of pool from the name of the host

Hello All,

Hope you all doing good. I'm working on a search options to get the pool name from the provided host name from all partition.

From the below command I'm finding the pool name but along with the pool name I'm finding other configuration as-well and I need only the pool name.

 

list ltm pool one-line recursive | grep "HOST_SERVER1"

Outputout as below

<SNIP>

ltm pool TESTING/pool-TEST

</SNIP>

 

Expected output:

pool-TEST

 

Could you please help is there any other possible ways wherein I can get only the pool name of the associated host?

 

Regards,

Thiyagu

2 Replies

  • What   suggested may work if its on the Common partition, because cut only works from bash. Not from inside tmsh. Also it will still give you the partition name cut -d " " -f3.

    Well in your case, its a partition - where TESTING is the partition name.

    Try this to get the pool name alone,

    tmsh -q -c "cd /; list ltm pool one-line recursive" | grep pool-TEST | awk '{print $3}' | cut -d "/" -f2

    Well yes you can still use the cut twice, one using " " as delimiter, then use "/" as delimiter.

    Also if you are doing some auditing, then refer the codeshare to export the config.

    Hope this helps.

  • You can use below command to get required o/p

     tmsh list ltm pool one-line | grep <node_name> | cut -d" " -f3

    Hope it helps!

    Mayur