Forum Discussion
ltaylor510_5583
Nimbostratus
Sep 18, 2008Perl script to display All BigIP pool members
I have a Perl CGI application in apache that will need a perl script to display all the available elements in one script:
("poolname" "address" "port" "session_state" "priority_group")
...
Thomas_LE_GENTI
Nimbostratus
Oct 10, 2008ok I found why.
It seems that p1.pl is launching my code. So I have to use only local variables using 'my'.
So it is working.
here is my code :
!/usr/bin/perl
use SOAP::Lite;
use lib ".";
use iControlTypeCast;
die ("Usage: $0 host uid pwd \n") if ($ARGV != 2);
my ($sHost,$sUID,$sPWD) = @ARGV;
my $LocalLBPool = SOAP::Lite
-> uri('urn:iControl:LocalLB/Pool')
-> proxy("https://$sUID:$sPWD\@$sHost/iControl/iControlPortal.cgi");
my $LocalLBPoolMember = SOAP::Lite
-> uri('urn:iControl:LocalLB/PoolMember')
-> proxy("https://$sUID:$sPWD\@$sHost/iControl/iControlPortal.cgi");
my $Soap = $LocalLBPool->get_list();
my $member;
my %SessionStatus;
foreach my $Pool (@{$Soap->result}) {
$Soap = $LocalLBPoolMember->get_session_status (SOAP::Data->name(pool_names => [$Pool]));
foreach $member (@{${$Soap->result}[0]}) {
$SessionStatus{"$member->{'member'}->{'address'}:$member->{'member'}->{'port'}"} = $member->{'session_status'};
}
$Soap = $LocalLBPoolMember->get_priority(SOAP::Data->name(pool_names => [$Pool]));
foreach $member (@{${$Soap->result}[0]}) {
print join (" ",
$Pool,
$member->{'member'}->{'address'},
$member->{'member'}->{'port'},
$SessionStatus{"$member->{'member'}->{'address'}:$member->{'member'}->{'port'}"},
$member->{'priority'}
,"\n"
);
}
}
Edit: it is {$Soap->result } [ 0 ]
and still have an error : "Use of uninitialized value in hash element at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/iControlTypeCast.pm line 189
any Idea ?
Thks
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