Description
How to extract Virtual Servers and Pools information to a .csv file
Environment
- Use this procedure when having the need of export the Virtual Server's and its Pool members across the configured partition of a BIG-IP system info to a .csv file
Cause
Not an issue
Recommended Actions
When is required to export the VIPs and Pools info to a .csv file, bellow a demonstration step by step with the use of an script* written for that purpose:
1.- In order to create the script you can do it with 'nano' for example, create one with the 'excel' name: (you can use other text editor like vi, but following example was done with nano)
# nano excel.sh
2.- Paste the script and then, Ctrl+x and type "Y" to save the changes:
echo vs name, destination, pool, pool members
VIRTUALS=$(tmsh -q -c "cd / ; list /ltm virtual recursive" | grep "ltm virtual" | awk -F' ' '{print "/"$3}')
for VS in $VIRTUALS;
do
echo -n $VS,
DEST=$(tmsh list ltm virtual $VS | grep destination | cut -d" " -f6)
echo -n $DEST,
POOL=$(tmsh list ltm virtual $VS | grep pool | cut -d" " -f6)
echo -n $POOL,
if [ -n "$POOL" ];
then
MBRS=$(tmsh list ltm pool "$POOL" | grep address | cut -d" " -f14)
echo -n $MBRS
fi
echo
done
3.- Change the permissions to execute the script:
# chmod 777 excel.sh
4.- Verify the script file has all the content with a cat:
[root@bigip_A_test:Active:In Sync] config # cat excel.sh echo vs name, destination, pool, pool members
VIRTUALS=$(tmsh -q -c "cd / ; list /ltm virtual recursive" | grep "ltm virtual" | awk -F' ' '{print "/"$3}')
for VS in $VIRTUALS;
do
echo -n $VS,
DEST=$(tmsh list ltm virtual $VS | grep destination | cut -d" " -f6)
echo -n $DEST,
POOL=$(tmsh list ltm virtual $VS | grep pool | cut -d" " -f6)
echo -n $POOL,
if [ -n "$POOL" ];
then
MBRS=$(tmsh list ltm pool "$POOL" | grep address | cut -d" " -f14)
echo -n $MBRS
fi
echo
done
[root@bigip_A_test:Active:In Sync] config #
5.- Execute the script with this command, and wait until it finish:
# ./excel.sh
6.- When finished, you can copy / paste the output to your Excel
spreadsheet and split the values to multiple columns (use 'space' as
field separator).
You will still have to manually format what's left to make it human-usable documentation.