Forum Discussion
Use iControlREST to find a virtual server by IP address
You need to get all the virtuals and filter on the client side. Yes, it may take some time to generate and transfer 2,500 virtuals information, but you can trim the amount of data (slightly). The following iControl REST call uses the tmsh
destination option to show only the destination addresses along with some other properties.
curl -sku : https:///mgmt/tm/ltm/virtual?options=destination
To further trim, use the
$select query option (although it does not reduce the amount of effort on the BIG-IP side, it reduces the amount of traffic on the wire). The following example gets the destination addresses/ports and the virtual names:
curl -sku : https:///mgmt/tm/ltm/virtual?options=destination\&\$select=destination,or,fullPath
Let us know if the call reduced the execution time.
Also, check how long it would take for the equivalent tmsh command to complete: e.g.,
time tmsh list ltm virtual destination. If it also takes 3 hours, then the system is either too busy or does not have enough resources to handle the request in timely manner, not because of limitations on iControl REST framework.
Another option is to run Unix
grep against /config/bigip.conf for specific virtual destinations: e.g.,
curl -sku : https:///mgmt/tm/util/bash \
-X POST -H "Content-type: application/json" \
-d "{\"command\":\"run\", \"utilCmdArgs\": \"-c '/tmp/sat 172.16.10.30:80'\"}" |
python -m json.tool | grep commandResult | sed 's/\\n/\n/g'
where
/tmp/sat is
!/bin/bash
grep -A 4 'ltm virtual ' /config/bigip.conf | egrep 'virtual|destination' | grep -B 1 $1
(you can directly put the series of greps in the iControl REST call itself but escaping the nested quotes properly would be fairly cumbersome).
I know. It does look ugly.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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