A Node is an IP address. Example: 10.10.10.10
A Pool Member is an IP Address + Port. Example: 10.10.10.10:8080
A Pool is a collection of Pool Members.
If you are managing an enterprise grade F5 infrastructure, there may come a time when you may have to replace a specific IP address with another IP address or replace multiple IP addresses in an F5 or multiple F5 devices.
This is a quick one-liner that will help you to identify all the pools that contain an IP address:
tmsh -q list ltm pool one-line | grep -E '($node_hostname|$node_ip)' | awk '{ print $3 }'
The above command should be run from “bash”.
Accessing F5’s bash:
root@LB1(/S1-green-P:Active)(tmos)# run util bash
[root@LB1:/S1-green-P:Active] ~ #
NOTE: The “list ltm pool one-line” is available in 11.x code and not available in 10.x code. The command will list each pool in a single line.
An Example:
[root@LB1:/S1-green-P:Active] ~ # tmsh -q list ltm pool one-line | grep -E '10.10.10.19' | awk '{ print $3 }' POOL_ta_lt_http_private POOL_ta_lt_private POOL_ta_lt_public POOL_ta_lt-maintainance POOL_ta_lt-private POOL_ta_lt-public
Reference: Devcentral – Pool
What if you want the pool member alongside the pool ?
tmsh -q list ltm pool one-line | egrep -E "$check:[0-9]+" | while read line; do myipport=$(echo $line | egrep -oE "$check:[0-9]+"); echo $line | awk '{printf "%s ",$3}'; echo "$myipport "; done
In the above line, replace “$check” with the IP Address that you are checking.
[root@LB1:/S1-green-P:Active] ~ #tmsh -q list ltm pool one-line | egrep -E "10.10.10.19:[0-9]+" | while read line; do myipport=$(echo $line | egrep -oE "10.10.10.19:[0-9]+"); echo $line | awk '{printf "%s ",$3}'; echo "$myipport "; done POOL_ta_lt_http_private 10.10.10.19:10542 POOL_ta_lt_public 10.10.10.19:10253 POOL_ta_lt_maintainance 10.10.10.19:10251 POOL_ta_lt_private 10.10.10.19:10092 POOL_ta_lt_public 10.10.10.19:10093
Keep up the good work 🙂
The post are very usefull.
Regards,
Dirk