Forum Discussion
Anthony_Gerace_
Aug 27, 2004Historic F5 Account
Service statistics
Hi,
Does the get_statistics method for LocalLB/Services work in BIG-IP v4.2?
If so, can you tell me what I’m doing wrong? I know there are stats for service 80, but when I run my sc...
Aug 27, 2004
Anthony, the method signature for get_statisics is the following:
void get_statistics(
in long[] services,
out ServiceStatisticEntry[] stats
);
struct ServiceStatisticEntry {
long service,
ServiceStatistics stats
};
struct ServiceStatistics {
ThruputStatistics thruput_stats,
ConnectionStatistics conn_stats
};
It takes as input an array of longs and returns an array of ServiceStatisticEntry structures. In your code it looks like you are treating the returned array as a single structure.
push @serv_Def, 80;
$soap_response = $soap->get_statistics(SOAP::Data->name(services => @serv_Def));
my $stats = @{$soap_response->result};
my $thruput_stats = $stats->{"thruput_stats"};
...
You will need to modify your code to loop through the returned array. Something like the following:
push @service_list, 80;
$soap_response = $LocalLBService->get_statistics
(
SOAP::Data->name(services => [@service_list])
);
Get Returned array of ServiceStatisticEntry structures
my $stats_list = @{$soap_response->result};
Loop over returned array
foreach $stats_entry (@stats_list)
{
Extract the service member from the ServiceStatisticEntry struct.
my $service = $stats_entry->{"service"};
Extract the stats member from the ServiceStatisticEntry struct.
my $stats = $stats_entry->{"stats"};
Extract the thruput_stats member from the ServiceStatistics struct.
my $thruput_stats = $stats->{"thruput_stats"};
my $bits_in = $thruput_stats->{"bits_in"};
my $bits_out = $thruput_stats->{"bits_out"};
my $packets_in = $thruput_stats->{"packets_in"};
my $packets_out = $thruput_stats->{"packets_out"};
Extract the conn_stats member from the ServiceStatistics struct.
my $conn_stats = $stats->{"connection_stats"};
my $cur_conn = $conn_stats->{"current_connections"};
my $max_conn = $conn_stats->{"maximum_connections"};
my $total_conn = $conn_stats->{"total_connections"};
...
}
In your case you should only be getting back an array of size 1, since you are only passing in a single item in the services parameter.
-Joe
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