| Probe-MachineInfo documentation | Contained in the Probe-MachineInfo distribution. |
Probe::MachineInfo::Metric - Base clas for metric collectors
blah
blah
new(%options)
get()
Proceeds to collect information about the machine by calling the _get_*_info methods.
log()
print()
Returns a string representing the metric. This is the metric name plus any units if specified by the subclass.
This method does not need to be called directly as the stringification operator is overloaded by this method.
units()
Returns the units in which the metric is in
Sagar R. Shah
| Probe-MachineInfo documentation | Contained in the Probe-MachineInfo distribution. |
package Probe::MachineInfo::Metric; # pragmata use overload '""' => 'print'; use strict; use warnings; # Standard Perl Library and CPAN modules use Log::Log4perl; # # CLASS ATTRIBUTES # # # CONSTRUCTOR #
sub new { my ($class, %options) = @_; my $self = { log => Log::Log4perl->get_logger($class), }; bless $self, $class; return $self->_init(%options) if($self->can('_init')); return $self; }
sub get { my ($self) = @_; die("Abstract Method\n"); }
sub log { my($self) = @_; return $self->{log}; }
sub print { my ($self) = @_; my $value = $self->get(); my $units = $self->units(); return ($units) ? "$value $units" : $value; }
sub units { my ($self) = @_; return ''; } 1;