Forum Discussion
Script to export list of Virtual Servers attached with HTTP profiles
Hi,
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.
It would be great if anyone can help me in this.
Thanks, Sai
- natheCirrocumulus
A bit of tmsh and grep should help. See this post where nitass does a similar thing:
https://devcentral.f5.com/questions/virtual-server-search-using-profile-on-it
Hope this helps,
N
- arpydaysNimbostratus
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..
tmsh -q -c "list ltm virtual recursive profiles {http} " | awk 'BEGIN {RS="\n}"} !/\ none/ {print}'| grep ^ltm | awk '{print $3}'
- arpydaysNimbostratus
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
Recent Discussions
Related Content
* 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