NAME
IBM::StorageSystem::StatisticsSet - Utility class for handling groups of IBM::StorageSystem statistics objects
SYNOPSIS
IBM::StorageSystem::StatisticsSet is utility class for handling groups of IBM::StorageSystem statistics objects
Note that you should not need to create a IBM::StorageSystem::StatisticsSet object manually under normal conditions, rather one will be created automatically for you on invocation to otrher method in <IBM::StorageSystem> packages.
IBM::StorageSystem::StatisticsSet provides some basic utility functions for manipulating and working with sets of statistics objects.
A StatisticsSet object is an nothing more than an array of homogenous statistics objects with the ability to perform some basic operations. The StatisticsSet is necessary to performing higher level functions and adding syntactical sugar.
Methods that return IBM::StorageSystem::StatisticsSet objects accept a single optional parameter; the interval period name - one of minute, hour, day, week, month, quarter or year. If you do not specify this parameter then the default value of minute will be used.
For example, to retrieve a StatisticsSet of IBM::StorageSystem::Statistic::Node::CPU objects for a IBM::StorageSystem::Node object, the following invocations are equivalent;
my @statistics_set = $node->cpu('minute')
my @statistics_set = $node->cpu;
METHODS
count
Returns the number of results in the statistics set.
values
Returns the attributes of the objects in the set - as all objects in a set are homogenous, the attributes returned are valid for all members of the set.
min( $attribute )
# Get the minimum monthly average memory value for the first node in our cluster
my $min_monthly_avg_memory = $ibm->nodes[0]->memory('month')->min('avg_memory')->avg_memory;
# In detail:
# On the first node
# | Get the memory stats
# | | For the year
# | | | Get the maximum value
# | | | | Of this variable
# | | | | | And display it
# V V V V V V
# $ibm->$nodes[0]->memory('year')->min('avg_memory')->avg_memory
# Get a list of all memory statistics for the previous day sorted by ascending
# value of average swap free memory
my @vals = $ibm->nodes[0]->memory->('day')->avg_swap_free_memmory;
In scalar context, this method returns the object having the minimum recorded value for the specified attribute parameter, where the parameter is a valid attribute name for the specified object type (i.e. the attribute parameter exists in the array returned by the values method).
In list context, this method returns a list of objects of the specified statistic type sorted by the attribute parameter.
max( $attribute )
This method is the logical complement of the min method - the method returns either a scalar or list as per the min method but sorted via maximum value. Function
avg
# Print the average number of read operations for all disks
foreach $node ( $ibm->nodes ) {
my $stats = node->disk_reads->avg;
foreach my $v ( sort $node->disk_reads->values ) {
print "Disk $v average read operations: ", $stats->$v, "\n"
}
}
# Prints:
#
# Disk dm_0 average read operations: 0.0333333333333333
# Disk dm_1 average read operations: 0.0333333333333333
# Disk dm_10 average read operations: 0.0333333333333333
# Disk dm_11 average read operations: 0.0333333333333333
# Disk dm_12 average read operations: 0.0333333333333333
# ... etc.
Returns a single IBM::StorageSystem statistics object containing averaged values for all objects in the StatisticsSet. The returned object is blessed into the class of the objects of the set.
first
Returns the first object in the set.
last
Returns the last object in the set.
next
# Print disk read operations for device 'dm-1'
my $read_stats = $node->disk_reads;
while ( my $stat = $read_stats->next ) {
printf("%-20s: %-10s\n", $stat->start_time, $stat->dm_1 )
}
On initial invocation, returns the first object in the statistics set. On subsequent invocations, returns the next statistic object in set. Returns undef if no items remain.
AUTHOR
Luke Poskitt, <ltp at cpan.org>
BUGS
Please report any bugs or feature requests to bug-ibm-v7000-statisticsset at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IBM-StorageSystem-StatisticsSet. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc IBM::StorageSystem::StatisticsSet
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=IBM-StorageSystem-StatisticsSet
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
http://cpanratings.perl.org/d/IBM-StorageSystem-StatisticsSet
Search CPAN
http://search.cpan.org/dist/IBM-StorageSystem-StatisticsSet/
LICENSE AND COPYRIGHT
Copyright 2012 Luke Poskitt.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.