Forum Discussion
robertoq_79472
Nimbostratus
Sep 02, 2009Get ALL virtual server names?
Hi There,
Fairly new to using iControl. I've been going through the API reference and I don't seem to find a way to get a list of ALL the virtual servers currently on my LTM. I want to be able to get the full list and then the pool-names followed by their respective members and IPs.
Has anyone done this already?
- L4L7_53191
Nimbostratus
You'll want to use the get_list() method from the LocalLB.VirtualServer wsdl. - L4L7_53191
Nimbostratus
Here's a specific sequence that may help. - rquezada, which language will you be using? Let me know and we can get you some sample code to help you out.
- In PowerShell, the code would look something like this:
$vs_list = (Get-F5.iControl).LocalLBVirtualServer.get_list() $pool_list = (Get-F5.iControl).LocalLBVirtualServer.get_default_pool_name($vs_list); $pool_members = (Get-F5.iControl).LocalLBPool.get_member($pool_list);
- JRahm
Admin
In python shell, very similar:>>> import pycontrol.pyControl as pc >>> b = pc.BIGIP( ... hostname = 'x.x.x.x', ... username = 'admin', ... password = 'admin', ... wsdl_files = ['LocalLB.VirtualServer', 'LocalLB.Pool'] ... ) Loading WSDL: LocalLB.VirtualServer.wsdl Loading WSDL: LocalLB.Pool.wsdl >>> v = b.LocalLB_VirtualServer >>> p = b.LocalLB_Pool >>> vs_list = v.get_list()['return'] >>> pool_list = v.get_default_pool_name(virtual_servers = vs_list)['return'] >>> pool_members = p.get_member(pool_names = pool_list)['return']
- robertoq_79472
Nimbostratus
I was looking for a perl script example - jethro_106302
Nimbostratus
hey guys, - L4L7_53191
Nimbostratus
Jethro: You're taking a massive performance hit by looping through each VS and making discrete iControl calls for each piece of information you're after (e.g. get_enabled_state). - jethro_106302
Nimbostratus
I agree making discrete iControl calls for each vs, pool, or pool member has an impact on performance. - jethro_106302
Nimbostratus
I managed to make the script run in ~4s with this modification:get a list of all VS configured on the appliance my $soapResponse = $VirtualServer->get_list(); &checkResponse($soapResponse); my @bla = @{$soapResponse->result}; $soapResponse = $VirtualServer->get_type ( SOAP::Data->name(virtual_servers => [@bla]) ); my @vs_type = @{$soapResponse->result}; my @vs_list; for $i (0 .. scalar(@bla) -1) { switch ($vs_type[$i]) { case "RESOURCE_TYPE_POOL" { push @vs_list, $bla[$i]; } } }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects