Cisco-UCS
view release on metacpan or search on metacpan
lib/Cisco/UCS/Common/PSU.pm view on Meta::CPAN
package Cisco::UCS::Common::PSU;
use warnings;
use strict;
use Carp qw(croak);
use Scalar::Util qw(weaken);
our $VERSION = '0.51';
our @ATTRIBUTES = qw(dn id model operability power presence revision serial
thermal vendor voltage);
our %ATTRIBUTES = (
operational => 'operState',
performance => 'perf'
);
#our
# 'outputCurrentMin' => '10.000000',
# 'input210vAvg' => '239.000000',
# 'outputPowerAvg' => '120.869995',
# 'outputCurrent' => '10.000000',
# 'ambientTemp' => '26.000000',
# 'psuTemp1' => '0.000000',
# 'output12vAvg' => '12.087000',
# 'output12vMin' => '12.087000',
# 'outputCurrentMax' => '10.000000',
# 'output12v' => '12.087000',
# 'timeCollected' => '2012-10-19T13:07:33.952',
# 'outputCurrentAvg' => '10.000000',
# 'psuTemp2' => '0.000000',
# 'suspect' => 'no',
# 'thresholded' => '',
# 'ambientTempMin' => '26.000000',
# 'ambientTempMax' => '26.000000',
# 'output3v3Max' => '3.048000',
# 'output12vMax' => '12.087000',
# 'outputPowerMin' => '120.869995',
# 'input210v' => '239.000000',
# 'outputPowerMax' => '120.869995',
# 'input210vMin' => '239.000000',
# 'ambientTempAvg' => '26.000000',
# 'outputPower' => '120.869995',
# 'output3v3Avg' => '3.048000',
# 'intervals' => '58982460',
# 'output3v3' => '3.048000',
# 'update' => '131073',
# 'dn' => 'sys/chassis-1/psu-1/stats',
# 'input210vMax' => '239.000000',
# 'output3v3Min' => '3.048000'
sub new {
my ( $class, %args ) = @_;
my $self = {};
bless $self, $class;
defined $args{dn}
? $self->{dn} = $args{dn}
: croak 'dn not defined';
defined $args{ucs}
? weaken($self->{ucs} = $args{ucs})
: croak 'ucs not defined';
my %attr = %{ $self->{ucs}->resolve_dn(
dn => $self->{dn}
)->{outConfig}->{equipmentPsu} };
while ( my ($k, $v) = each %attr ) { $self->{$k} = $v }
return $self;
}
{
no strict 'refs';
while ( my ( $pseudo, $attribute ) = each %ATTRIBUTES ) {
*{ __PACKAGE__ . '::' . $pseudo } = sub {
return $_[0]->{$attribute}
}
}
foreach my $attribute (@ATTRIBUTES) {
*{ __PACKAGE__ . '::' . $attribute } = sub {
return $_[0]->{$attribute}
}
}
}
1;
__END__
=pod
=head1 NAME
Cisco::UCS::Common::PSU - Class for operations with a Cisco UCS PSU.
=head1 SYNOPSIS
foreach my $psu (sort $ucs->chassis(1)->get_psus) {
print 'PSU ' . $psu->id . ' voltage: ' . $psu->voltage . "\n"
}
# PSU 1 voltage: ok
# PSU 2 voltage: ok
# PSU 3 voltage: ok
# PSU 4 voltage: ok
=head1 DESCRIPTION
Cisco::UCS::Common::PSU is a class providing common operations with a Cisco
UCS PSU.
Note that you are not supposed to call the constructor yourself, rather a
Cisco::UCS::Common::PSU object is created for you automatically by query
methods in other classes like L<Cisco::UCS::Chassis>.
=head1 METHODS
=head3 id
( run in 1.329 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )