25-Apr-2021 19:41
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
26-Apr-2021
00:01
- last edited on
04-Jun-2023
20:56
by
JimmyPackets
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
26-Apr-2021
10:04
- last edited on
04-Jun-2023
20:56
by
JimmyPackets
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.