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 ca...
Published May 05, 2015
Version 1.0suttonsc
Employee
Joined May 16, 2019
suttonsc
Employee
Joined May 16, 2019
Sec-Enabled_658
Jun 03, 2015Cirrostratus
I kinda wrote my own, figured that I would share. This script shows each virtual server associated pool, pool member, and also shows the monitor that is being used by the pool. I call it the vipmapper. Also shows which virtual servers don't have a pool assigned.
virtuallist=$(tmsh list ltm virtual | grep virtual | cut -d' ' -f3 | tr "\n" " " );
for v in $virtuallist ;
do
DEST="";
POOL="";
MEMB="";
DEST=$(tmsh list ltm virtual $v | grep destination | cut -d' ' -f6)
POOL=$(tmsh list ltm virtual $v | grep pool | cut -d' ' -f6)
MEMB=$(tmsh list ltm pool $POOL | egrep ':|address '| sed '$!N;s/\n/ /')
MON=$(tmsh list ltm pool $POOL | grep " monitor")
if [ "$POOL" != "" ];
then
echo "";
echo " Virtual: $v - $DEST";
echo " Pool: $POOL"- $MON;
echo "$MEMB";
else
echo "";
echo "!! Virtual $v $DEST has no pool assigned";
echo "";
fi
done