Add fan and psu reporting to Layer3::Dell

This commit is contained in:
Oliver Gorwits
2015-02-28 12:47:59 +00:00
parent db6c3573c1
commit 73d713b670
2 changed files with 68 additions and 0 deletions

View File

@@ -1,5 +1,11 @@
SNMP::Info - Friendly OO-style interface to Network devices using SNMP. SNMP::Info - Friendly OO-style interface to Network devices using SNMP.
version 3.26 ()
[ENHANCEMENTS]
* Add fan and psu reporting to Layer3::Dell
version 3.25 (2015-02-25) version 3.25 (2015-02-25)
[ENHANCEMENTS] [ENHANCEMENTS]

View File

@@ -153,6 +153,48 @@ sub serial {
return $dell->SUPER::serial(); return $dell->SUPER::serial();
} }
# check all fans, and report overall status
sub fan {
my $dell = shift;
my $fan = $dell->dell_fan_desc() || {};
my $state = $dell->dell_fan_state() || {};
my @messages = ();
foreach my $k (keys %$fan) {
next if $state->{$k} and $state->{$k} eq 'normal';
push @messages, "$fan->{$k}: $state->{$k}";
}
push @messages, ((scalar keys %$fan). " fans OK")
if scalar @messages == 0;
return (join ", ", @messages);
}
sub _ps_status {
my ($dell, $unit) = @_;
my $status = 'unknown';
return $status if !defined $unit;
my $desc = $dell->dell_pwr_desc() || {};
my $state = $dell->dell_pwr_state() || {};
foreach my $k (keys %$desc) {
next unless $desc->{$k} and $desc->{$k} eq "ps1_unit$unit";
return ($state->{$k} || $status);
}
return $status;
}
sub ps1_type { return 'internalRedundant' }
sub ps2_type { return 'internalRedundant' }
sub ps1_status { return (shift)->_ps_status(1) }
sub ps2_status { return (shift)->_ps_status(2) }
sub interfaces { sub interfaces {
my $dell = shift; my $dell = shift;
my $partial = shift; my $partial = shift;
@@ -312,6 +354,26 @@ id(). Defaults to 'dlink'.
Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in
id(). Defaults to 'dlink'. id(). Defaults to 'dlink'.
=item $dell->fan()
Return the status of all fans from the F<Dell-Vendor-MIB>
=item $dell->ps1_type()
Return the type of the first power supply from the F<Dell-Vendor-MIB>
=item $dell->ps2_type()
Return the type of the second power supply from the F<Dell-Vendor-MIB>
=item $dell->ps1_status()
Return the status of the first power supply from the F<Dell-Vendor-MIB>
=item $dell->ps2_status()
Return the status of the second power supply from the F<Dell-Vendor-MIB>
=back =back
=head2 Overrides =head2 Overrides