I’m been asked to update all the virtual servers having http profile with logging iRule. Now, in my environment I have thousands of virtuals servers in each BIG-IP of APAC/ EMEA / US and therefore it would be laborious process to extract all this information and attach iRule to them.
I’m looking for some script (to find virtual servers having http profile) that I can run on LTM which could be exported into excel so as to send that details to CAB meeting in our system and also it would be easy for me to delegate some of the work and to perform check and balance.
you could try this, it limits the scope to specifically VSs with ‘http’ profile name otherwise you may get hits for VSs with http in the VS name or rule name etc..
Save this as an executable script and run it, it should list the VS name, VS IP and pool member IPs.
cheers
!/bin/bash
List VSs with 'http' profile name
VS=`tmsh -q -c "list ltm virtual recursive profiles {http} " | 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