Forum Discussion
Use iControlREST to find a virtual server by IP address
Is there any way to use iControlREST to search for a virtual server by IP address, that doesn't involve returning all virtual servers and filtering the results? There's an individual using my LTM PowerShell module who has 2500 virtual servers and they need to search them by IP address. Currently it's taking up to 3 hours for results. Thanks.
- Satoshi_Toyosa1Ret. Employee
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
option to show only the destination addresses along with some other properties.destination
curl -sku : https:///mgmt/tm/ltm/virtual?options=destination
To further trim, use the
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:$select
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.,
. 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.time tmsh list ltm virtual destination
Another option is to run Unix
againstgrep
for specific virtual destinations: e.g.,/config/bigip.conf
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
is/tmp/sat
!/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.
- Satoshi_Toyosa1Ret. Employee
P.S. I measured the performance of iControl REST GET against 2,500+ virtuals on my box and it took me only 3s. The returned json object is 3 MB in size. I don't know why it takes 3 hours in your environment.
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