Forum Discussion
Ramya_68133
Nimbostratus
Sep 12, 2013get_member_v2 method perl code
I am looking for sample code in perl for get_member_v2 method to pull the pool member list.I would really appareciate if some one can give me inputs on that
Appreciate your help
Thanks
Sep 13, 2013
This Should get you going. I wrote this for the first time here, so it's not tested. Hopefully there aren't any bad typos...
In the future, check out the iControl CodeShare for a lot of Perl examples. A list of perl specific examples can be found here: https://devcentral.f5.com/wiki/iControl.perl.ashx
use SOAP::Lite
use MIME::Base64
BIG-IP address
$bigip = "10.10.10.10";
$user = "someuser";
$pass = "somepass";
sub SOAP::Transport::HTTP::Client::get_basic_credentials
{
return "$user" => "$pass";
}
$Pool = SOAP::Lite
-> url("urn:iControl:LocalLB/Pool")
-> proxy("https://$bigip/iControl/iControlPortal.cgi");
Get list of pools
my $soapResponse = $Pool->get_list();
my @pool_list = @{$soapResponse->result};
$soapResponse = $Pool.get_member_v2(
SOAP::Data->name(pool_names => [@pool_list])
);
@AddressPortAofA = @{$soapResponse->result};
for $i (0 .. $pool_list)
{
$pool = $pool_list[$i];
print "+ POOL $pool";
@AddressPortA = @{$AddressPortAofA[$i]};
foreach $j (0 .. $AddressPortA)
{
$AddressPort = @AddressPortA[$j];
$address = $AddressPort->{"address"};
$port = $AddressPort->{"port"};
print "| ${address}:${port}";
}
}
Hope this helps...
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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