bash script to list which virtual servers are using a specific pool.
Problem this snippet solves:
bash script to list which virtual servers are using a specific pool
How to use this snippet:
Usage:script_name pool_name pool_name ...
Remember to use the correct case and full pool names.
Code :
#!/bin/bash Err_NOARGS=75 if [ ! -n "$1" ] then echo "Usage: `basename $0` pool_name pool_name etc..." exit $Err_NOARGS fi for pools in "$@" do echo "Virtual Servers using Pool: $pools" echo for vips in `tmsh list /ltm virtual pool | grep -x -B2 " pool ${pools}" | awk -F" virtual |\{" '{print $2}' 2>/dev/null` do echo " $vips" done echo done
Tested this on version:
11.6Published May 05, 2015
Version 1.0