BigIP-iControl
view release on metacpan or search on metacpan
lib/BigIP/iControl.pm view on Meta::CPAN
foreach my $pool ($ic->get_ltm_pool_list()) {
print "\n\n$pool:\n";
foreach my $member ($ic->get_ltm_pool_members($pool)) {
print "\t$member\n";
}
}
Returns a list of the pool members for the specified LTM pool. This method takes one mandatory parameter; the name of the pool.
Pool member are returned in the format B<IP_address:service_port>.
=cut
sub get_ltm_pool_members {
my ($self, $pool)= @_;
my @members;
foreach (@{@{$self->__get_pool_members($pool,'LocalLB')}[0]}) {push @members, ($_->{address}.':'.$_->{port})}
return @members;
}
=head3 get_gtm_pool_members ($pool)
Returns a list of the pool members for the specified GTM pool. This method takes one mandatory parameter; the name of the pool.
Pool member are returned in the format B<IP_address:service_port>.
=cut
sub get_gtm_pool_members {
my ($self,$pool)=@_;
my @members;
foreach (@{@{$self->__get_pool_members($pool,'GlobalLB')}[0]}) {push @members, $_->{member}->{address}.':'.$_->{member}->{port}}
return @members
}
sub __get_pool_members {
my ($self, $pool, $module)= @_;
return $self->_request(module => $module, interface => 'Pool', method => 'get_member', data => {pool_names => [$pool]});
}
=head3 get_pool_statistics ($pool)
my %stats = $ic->get_pool_statistics($pool);
Returns the statistics for the specified pool as a PoolStatistics object. For pre-parsed pool statistics consider using
the B<get_pool_statistics_stringified> method.
=cut
sub get_pool_statistics {
my ($self, $pool)= @_;
return $self->_request(module => 'LocalLB', interface => 'Pool', method => 'get_statistics', data => {pool_names => [$pool]});
}
=head3 get_pool_statistics_stringified ($pool)
my %stats = $ic->get_pool_statistics_stringified($pool);
print "Pool $pool bytes in: $stats{stat}{STATISTIC_SERVER_SIDE_BYTES_OUT}";
Returns a hash containing all pool statistics for the specified pool in a delicious, easily digestable and improved formula.
=cut
sub get_pool_statistics_stringified {
my ($self, $pool)= @_;
return __process_statistics($self->get_pool_statistics($pool));
}
=head3 get_pool_member_statistics ($pool)
Returns all pool member statistics for the specified pool as an array of MemberStatistics objects. Unless you feel like
playing with Data::Dumper on a rainy Sunday afternoon, consider using B<get_pool_member_statistics_stringified> method.
=cut
sub get_pool_member_statistics {
my ($self, $pool)= @_;
return $self->_request(module => 'LocalLB', interface => 'PoolMember', method => 'get_statistics', data => {
pool_names => [$pool],
members => $self->__get_pool_members($pool,'LocalLB') });
}
=head3 get_pool_member_object_status ($pool)
Returns all pool member stati for the specified pool as an array of MemberObjectStatus objects.
=cut
sub get_pool_member_object_status {
my ($self, $pool) = @_;
return $self->_request(module => 'LocalLB', interface => 'PoolMember', method => 'get_object_status', data => {
pool_names => [$pool],
});
}
=head3 get_pool_member_statistics_stringified ($pool)
my %stats = $ic->get_pool_member_statistics_stringified($pool);
print "Member\t\t\t\tRequests\n",'-'x5,"\t\t\t\t",'-'x5,"\n";
foreach my $member (sort keys %stats) {
print "$member\t\t$stats{$member}{stats}{STATISTIC_TOTAL_REQUESTS}\n";
}
# Prints a list of requests per pool member
Returns a hash containing all pool member statistics for the specified pool. The hash has the following
structure;
member_1 => {
timestamp => 'YYYY-MM-DD-hh-mm-ss',
stats => {
statistics_1 => value
...
statistic_n => value
}
( run in 0.841 second using v1.01-cache-2.11-cpan-df04353d9ac )