Forum Discussion
Aaron_McMahon_2
Nimbostratus
Jun 01, 2006Get statistics history instead of current snapshot?
Is there a way to get a statistic's history instead of just the current value? I notice in the BIG-IP GUI, I can go to the Performance window and it shows a graph with the history of various statistics like throughput bits per second. But iControl seems to just give me a current total.
Thanks...
- Aaron
- The data behind the Performance graphs are available via iControl with the following methods:
!/usr/bin/perl ---------------------------------------------------------------------------- The contents of this file are subject to the "END USER LICENSE AGREEMENT FOR F5 Software Development Kit for iControl"; you may not use this file except in compliance with the License. The License is included in the iControl Software Development Kit. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is iControl Code and related documentation distributed by F5. The Initial Developer of the Original Code is F5 Networks, Inc. Seattle, WA, USA. Portions created by F5 are Copyright (C) 1996-2004 F5 Networks, Inc. All Rights Reserved. iControl (TM) is a registered trademark of F5 Networks, Inc. Alternatively, the contents of this file may be used under the terms of the GNU General Public License (the "GPL"), in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the License, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the License or the GPL. ---------------------------------------------------------------------------- use SOAP::Lite + trace => qw(method debug); use SOAP::Lite; use MIME::Base64; BEGIN { push (@INC, ".."); } use iControlTypeCast; ---------------------------------------------------------------------------- Validate Arguments ---------------------------------------------------------------------------- my $sHost = $ARGV[0]; my $sPort = $ARGV[1]; my $sUID = $ARGV[2]; my $sPWD = $ARGV[3]; my $sGraphName = $ARGV[4]; my $sProtocol = "https"; if ( ("80" eq $sPort) or ("8080" eq $sPort) ) { $sProtocol = "http"; } if ( ($sHost eq "") or ($sPort eq "") or ($sUID eq "") or ($sPWD eq "") ) { die ("Usage: PerformanceGraphs.pl host port uid pwd [graph_name]\n"); } ---------------------------------------------------------------------------- Transport Information ---------------------------------------------------------------------------- sub SOAP::Transport::HTTP::Client::get_basic_credentials { return "$sUID" => "$sPWD"; } $Statistics = SOAP::Lite -> uri('urn:iControl:System/Statistics') -> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi"); eval { $Statistics->transport->http_request->header ( 'Authorization' => 'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '') ); }; if ( "" eq $sGraphName ) { &getPerformanceGraphList(); } else { &getPerformanceGraph("detailthroughput"); &getPerformanceGraph("CPU"); &getPerformanceGraph($sGraphName); } ---------------------------------------------------------------------------- sub getPerformanceGraph ---------------------------------------------------------------------------- sub getPerformanceGraph() { ($graph_name) = (@_); print "Requesting Graph: $graph_name\n"; $PerformanceGraphQuery = { object_name => $graph_name, start_time => 0, end_time => 0, interval => 0, maximum_rows => 0 }; $soapResponse = $Statistics->get_performance_graph_csv_statistics ( SOAP::Data->name(objects => [$PerformanceGraphQuery]) ); &checkResponse($soapResponse); @PerformanceGraphCSVList = @{$soapResponse->result}; foreach $PerformanceGraphCSV (@PerformanceGraphCSVList) { $object_name = $PerformanceGraphCSV->{"object_name"}; $start_time = $PerformanceGraphCSV->{"start_time"}; $end_time = $PerformanceGraphCSV->{"end_time"}; $interval = $PerformanceGraphCSV->{"interval"}; $statistic_data = $PerformanceGraphCSV->{"statistic_data"}; $file_name = &generateFileName($object_name); print "===================================\n"; print "Object Name: $object_name\n"; print "Start Time : $start_time\n"; print "End Time : $end_time\n"; print "Interval : $interval\n"; print "Statistics : stored in file '$file_name'\n"; print "===================================\n"; open (LOCAL_FILE, ">$file_name") or die ("Can't open $file_name for output!"); print LOCAL_FILE $statistic_data; close(LOCAL_FILE); } } ---------------------------------------------------------------------------- sub getPerformanceGraphList ---------------------------------------------------------------------------- sub getPerformanceGraphList() { $soapResponse = $Statistics->get_performance_graph_list(); &checkResponse($soapResponse); print "--------------------------------------------\n"; print " Available Performance Graphs\n"; print "--------------------------------------------\n"; @PerformanceGraphList = @{$soapResponse->result}; foreach $PerformanceGraph (@PerformanceGraphList) { $graph_name = $PerformanceGraph->{"graph_name"}; $graph_title = $PerformanceGraph->{"graph_title"}; $graph_description = $PerformanceGraph->{"graph_description"}; printf "%20s - $graph_description\n", $graph_name; } } ---------------------------------------------------------------------------- checkResponse ---------------------------------------------------------------------------- sub checkResponse() { my ($soapResponse) = (@_); if ( $soapResponse->fault ) { print $soapResponse->faultcode, " ", $soapResponse->faultstring, "\n"; exit(); } } ---------------------------------------------------------------------------- sub generateFileName ---------------------------------------------------------------------------- sub generateFileName() { ($report_name) = (@_); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year += 1900; $sName = sprintf("%s-%04d%02d%02d_%02d%02d%02d.csv", $report_name, $year, $mon, $mday, $hour, $min, $sec); return $sName; }
- David_Murphy_22
Nimbostratus
I was looking at one csv file returned by this example: - David_Murphy_22
Nimbostratus
Nevermind about the timestamp .. it's a unix type timestamp .. I have the conversion part done. - David_Murphy_22
Nimbostratus
Considering the screen output: - Answered in this thread:
http://devcentral.f5.com/Default.aspx?tabid=53&forumid=1&tpage=1&view=topic&postid=1767417719
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