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 script I get all zero’s.
If not, how can I get the statistics for a given service?
Using the trace gives no insight. Any suggestions?
Thanks
Anthony
Output from b service 80 show
bipmkoqa01:~ b service 80 show
SERVICE 80 tcp enabled timeout 1005 udp enabled timeout 60
(cur, max, limit, tot, reaped) = (27, 834, 0, 1696219, 1773)
(pckts, bits) in = (13794715, 19070346376), out = (13972196, 122260660800)
Output from my script
Sleeping for 5 seconds, please wait....
The Deltas over the past 5 seconds are:
Total Bytes is: 0
Total Packets is: 0
Total Connections is: 0
Sleeping for 5 seconds, please wait....
The Deltas over the past 5 seconds are:
Total Bytes is: 0
Total Packets is: 0
Total Connections is: 0
Totals for the last 15 seconds ...
Total number of Bytes transferred: 0
Total number of Connections: 0
Output complete
---------------------------------------------------------------------------------------------------------------------------------------
Subroutine to get service stats.
sub getStats {
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"};
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"};
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"};
my $bits_per_byte = 8;
my $total_bytes = ($bits_in + $bits_out) / $bits_per_byte;
my $total_pcts = $packets_in + $packets_out;
my $out = { total_bytes => $total_bytes, total_pkts => $total_pcts, total_conns => $total_conn, curr_con => $cur_conn };
}
$outputT0 = &getStats();
my $t0_byte = $outputT0->{"total_bytes"};
my $t0_pkts = $outputT0->{"total_pkts"};
my $t0_tconn = $outputT0->{"total_conns"};
my $t0_curcon = $outputT0->{"curr_con"};
print "\nSleeping for $Time2Sleep seconds, please wait....\n";
sleep $Time2Sleep;
$outputT1 = &getStats();
my $t1_byte = $outputT1->{"total_bytes"};
my $t1_pkts = $outputT1->{"total_pkts"};
my $t1_tconn = $outputT1->{"total_conns"};
my $t1_curcon = $outputT1->{"curr_con"};
$Diff_Tbytes = $t1_byte - $t0_byte;
$Diff_Tpkts = $t1_pkts - $t0_pkts;
$Diff_Tconn = $t1_tconn - $t0_tconn;
- 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 };
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"}; ...
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"}; ... }
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