Probe::MachineInfo::Metric - Base clas for metric collectors


Probe-MachineInfo documentation Contained in the Probe-MachineInfo distribution.

Index


Code Index:

NAME

Top

Probe::MachineInfo::Metric - Base clas for metric collectors

SYNOPSIS

Top

blah

DESCRIPTION

Top

blah

PUBLIC INTERFACE

Top

new

 new(%options)

get

 get()

Proceeds to collect information about the machine by calling the _get_*_info methods.

log

 log()

print

units

 units()

Returns the units in which the metric is in

AUTHOR

Top

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;