Forum Discussion
I want to find nodes/pools which are associated with all pool/VIPs?
Hi All,
Please help me. I have to decommissions some nodes and pools out of 1000 VIPs. Is there any way I can find it via CLI (GUI I know how to check but do not have access of GUI in the current environment)
- Find nodes which are associated with all Pools
- Pools which are associated with all VIPs
Thanks
- jaikumar_f5
Noctilucent
Well in CLI its pretty easy with one-line command, to lookup an VIP or to look up a pool, one-line is a favorite. Try it.
To find a node if its part of any pool. where 1.1.1.1 is the node that you want to check if its part of any pool.
tmsh list ltm pool one-line | grep 1.1.1.1 | awk '{print $3}'
The output will be just the pool names.
Similarly to find the pools referenced in any VS. where my-app-pool-name is the pool name
tmsh list ltm virtual one-line | grep my-app-pool-name | awk '{print $3}'
The output will be just the VS names.
Same you can use to find the VS setup with a VIP, where 1.2.3.4:443 is my VIP
tmsh list ltm virtual one-line | grep 1.2.3.4:443 | awk '{print $3}'
If you want to do it on bulk, you can simply put a bash script and put a loop to find both the pool names and the corresponding VS details.
- Atanu1979
Nimbostratus
Wow. The commands are working Great. Thanks a lot for your help
Hi jaikumar_f5, I have one more issue that is when ever I am running any .sh(bash script) it is show error. Few of them I have copied from this forum but not able to tset. Could you please help me on this. I am very new in F5 so may be not able to understand the way it work. For example in below script :-
! /bin/bash
output=$(tmsh list ltm virtual |grep "ltm virtual" | awk -F" " '{ print $3 }')
for LINE in ${output}; do
pool=$(tmsh list ltm virtual ${LINE} pool |grep pool |awk -F" " '{ print $2 }')
if [ $pool != none ]
then
echo "Virtual: ${LINE}:"
tmsh list ltm pool $pool load-balancing-mode
fi
done
Error:-
[root@My-VM-Lab-F5-1:Active:Standalone] tmp # ./LBMethod.sh
: No such file or directory
./LBMethod.sh: line 2: $'\r': command not found
./LBMethod.sh: line 3: syntax error near unexpected token `$'do\r''
'/LBMethod.sh: line 3: `for LINE in ${output}; do
[root@My-VM-Lab-F5-1:Active:Standalone] tmp # ls -l
total 58
-rw-------. 1 root root 0 Jul 23 18:02 bwc-tmm.mp.bwcdist
-r--r--r--. 1 root root 171 Jul 24 23:05 dhclient.sh
-r--r--r--. 1 root root 213 Jul 24 23:05 hosts_script
drwxr-xr-x. 2 root root 1024 Jul 24 23:06 hsperfdata_root
drwxr-xr-x. 2 tomcat tomcat 1024 Jul 24 23:06 hsperfdata_tomcat
-r--r-----. 1 root root 702 Jul 24 23:05 httpd_reconfig.pl
-rwxrwxrwx. 1 root root 329 Jul 26 11:52 LBMethod.sh
for most of script I am having same type of issue. I am having very little knowledge on scripting may that's why not able to understand the issue.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com