Forum Discussion
gdoyle
Cirrostratus
Feb 07, 2017Virtual Server/Pool Member listing.
Hey, y'all.
I'm trying to put together a spreadsheet including the following information:
Virtual server name, virtual server IP, pool names, pool members, ports, and partition.
This i...
Feb 07, 2017
Hi,
Here is the script to list all of your virtual servers:
!/bin/bash
List VSs with 'http' profile name
VS=`tmsh -q -c "list ltm virtual " | awk 'BEGIN {RS="\n}"} !/\ none/ {print}'| grep ^ltm | awk '{print $3}'`
Get pool name for each VS
for all in ${VS}
do
POOL=`tmsh -q list ltm virtual $all pool | awk '/pool/ {print $2}'`
DESTINATION=`tmsh -q list ltm virtual $all destination | awk -F'[ :]' '/destination/ {print $6}'`
if [ "$POOL" != "none" ]
then
POOLIP=`tmsh list ltm pool $POOL members| awk -F '[ :]' -v ORS=", " '/^ +[0-9]/ {print $9; count++ }'`
else
POOLIP="-"
fi
printf "%-45s %-20s %-20s %-s\n" "$all" "$DESTINATION" "$POOLIP"
done
Login with ssh and go to the /tmp directory. Take your favorite editor (vi/nano) open a file named script.sh and past the script in it.
Save it.
Make it executable (chmod +x script.sh) run the script ./script.sh
If you want it to send the list to a file type ./script.sh >>/tmp/list.txt
Cheers,
Kees
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects