From f9c4c5b2963432d45fe25aebcb5b74c8bd3f476d Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Thu, 22 Jan 2015 17:12:00 +0100 Subject: [PATCH] Refs #5627 --- .../storage/netapp/mode/components/fan.pm | 4 ++-- .../storage/netapp/mode/components/voltage.pm | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/centreon-plugins/storage/netapp/mode/components/fan.pm b/centreon-plugins/storage/netapp/mode/components/fan.pm index 50567ffd2..aee355834 100644 --- a/centreon-plugins/storage/netapp/mode/components/fan.pm +++ b/centreon-plugins/storage/netapp/mode/components/fan.pm @@ -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}++; diff --git a/centreon-plugins/storage/netapp/mode/components/voltage.pm b/centreon-plugins/storage/netapp/mode/components/voltage.pm index 367490a1c..662647c10 100644 --- a/centreon-plugins/storage/netapp/mode/components/voltage.pm +++ b/centreon-plugins/storage/netapp/mode/components/voltage.pm @@ -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]/);