Forum Discussion
Ramya_68133
Nimbostratus
Oct 24, 2013Retriving pool memeber from the pool name
Hi Joe Pruitt,
I am trying to retrive pool members with the object statusfrom any given poolname. I want the output to be printed like below but I get only hash_ref .Can you please help?
'/Common/10.116.38.51', 10.116.38.51:80, enabled:ENABLED, availability:GREEN
'/Common/10.116.38.52', 10.116.38.52:80, enabled:ENABLED, availability:GREEN
Below is my *.pm script
my $soapResponse = $LBPool->get_member_v2(
SOAP::Data->name( pool_names => [$poolname] ) );
my @member_lists = @{$soapResponse->result};
$soapResponse = $LBPool->get_member_object_status(
SOAP::Data->name(pool_names => [$poolname]),
SOAP::Data->name(members => [@member_lists])
my $member_objectstatus = $soapResponse->result;
my @status = @member_lists;
push (@status,@memberobjectstatus);
use Data::Dumper;
print dumper (@status);
SO that status will have all the member, port and object status in @status will have bless of hashes like below
$VAR1 = bless( [ bless( { 'address' => '/Common/10.116.38.51', 'port' => '80' }, 'Common::AddressPort' ), bless( { 'address' => '/Common/10.116.38.52', 'port' => '80' }, 'Common::AddressPort' ) ], 'Common::AddressPort[]' ); $VAR2 = bless( [ bless( { 'availability_status' => 'AVAILABILITY_STATUS_GREEN', 'status_description' => 'Pool member is available', 'enabled_status' => 'ENABLED_STATUS_ENABLED' }, 'LocalLB::ObjectStatus' ), bless( { 'availability_status' => 'AVAILABILITY_STATUS_GREEN', 'status_description' => 'Pool member is available', 'enabled_status' => 'ENABLED_STATUS_ENABLED' }, 'LocalLB::ObjectStatus' ) ], 'LocalLB::ObjectStatus[]' );
my %members;
foreach my $member (@status){
$members{ $status->{'address'} =
$member->{'port'}};
$members{ $status}->{'enabled'} =
$ENABLED_STATUS_MAP->{ $status->{'enabled_status'} } ;
$members{ $status}->{'availability'} =
$AVAILABILITY_STATUS_MAP->{ $status->{'availability_status'} } ;
return %members
}
Main Program :
foreach my $member ( sort keys %{$membershref} ) {
print li(
"'$member', $membershref->{$member}->{'address'}:$membershref->{$member}->{'port'},
enabled:$membershref->{$member}->{'enabled'}, availability:$memb
ershref->{$member}->{'availability'}"
when I run the program I get below output
HASH(0xc61b00)', :, enabled:, availability:
No RepliesBe the first to reply
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