This commit is contained in:
Quentin Garnier 2015-01-22 17:12:00 +01:00
parent d438a0cd20
commit e45537e59a
2 changed files with 9 additions and 8 deletions

View File

@ -64,12 +64,12 @@ sub check {
my $shelf_addr = $self->{shelf_addr}->{$oid_enclChannelShelfAddr . '.' . $i};
my $present = $self->{results}->{$oid_enclFansPresent}->{$oid_enclFansPresent . '.' . $i};
my $failed = $self->{results}->{$oid_enclFansFailed}->{$oid_enclFansFailed . '.' . $i};
my @current_speed = split /,/, $self->{results}->{$oid_enclFansSpeed}->{$oid_enclFansSpeed . '.' . $i};
my @current_speed = defined($self->{results}->{$oid_enclFansSpeed}->{$oid_enclFansSpeed . '.' . $i}) ? split /,/, $self->{results}->{$oid_enclFansSpeed}->{$oid_enclFansSpeed . '.' . $i} : ();
foreach my $num (split /,/, $present) {
$num = centreon::plugins::misc::trim($num);
next if ($num !~ /[0-9]/);
my $current_value = ($current_speed[$num - 1] =~ /(^|\s)([0-9]+)/) ? $2 : '';
my $current_value = (defined($current_speed[$num - 1]) && $current_speed[$num - 1] =~ /(^|\s)([0-9]+)/) ? $2 : '';
next if ($self->check_exclude(section => 'fan', instance => $shelf_addr . '.' . $num));
$self->{components}->{fan}->{total}++;

View File

@ -83,14 +83,15 @@ sub check {
for (my $i = 1; $i <= $self->{number_shelf}; $i++) {
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclTable}, instance => $i);
my $shelf_addr = $self->{shelf_addr}->{$oid_enclChannelShelfAddr . '.' . $i};
my @current_volt = split /,/, $result->{enclVoltSensorsCurrentVolt};
my @current_volt = defined($result->{enclVoltSensorsCurrentVolt}) ? split /,/, $result->{enclVoltSensorsCurrentVolt} : ();
my @warn_under_thr = split /,/, $result->{enclVoltSensorsUnderVoltWarnThr};
my @crit_under_thr = split /,/, $result->{enclVoltSensorsUnderVoltFailThr};
my @warn_over_thr = split /,/, $result->{enclVoltSensorsOverVoltWarnThr};
my @crit_over_thr = split /,/, $result->{enclVoltSensorsOverVoltFailThr};
my @warn_under_thr = defined($result->{enclVoltSensorsUnderVoltWarnThr}) ? split /,/, $result->{enclVoltSensorsUnderVoltWarnThr} : ();
my @crit_under_thr = defined($result->{enclVoltSensorsUnderVoltFailThr}) ? split /,/, $result->{enclVoltSensorsUnderVoltFailThr} : ();
my @warn_over_thr = defined($result->{enclVoltSensorsOverVoltWarnThr}) ? split /,/, $result->{enclVoltSensorsOverVoltWarnThr} : ();
my @crit_over_thr = defined($result->{enclVoltSensorsOverVoltFailThr}) ? split /,/, $result->{enclVoltSensorsOverVoltFailThr} : ();
foreach my $num (split /,/, $result->{enclVoltSensorsPresent}) {
my @values = defined($result->{enclVoltSensorsPresent}) ? split /,/, $result->{enclVoltSensorsPresent} : ();
foreach my $num (@values) {
$num = centreon::plugins::misc::trim($num);
next if ($num !~ /[0-9]/);