Kaynağa Gözat

Some objects returned from an interface don't have a defined entry for our snmpLocIfDescr key - don't operate on the value unless it exists

madlohe 4 yıl önce
ebeveyn
işleme
de7ebf90c3
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      plugins-scripts/check_ifstatus.pl

+ 1 - 1
plugins-scripts/check_ifstatus.pl

@@ -187,7 +187,7 @@ foreach $key (keys %ifStatus) {
 				#counter for matching descriptions
 				my $match_descr = 0;
 				foreach my $description (@exclude_descriptions) {
-					if ($ifStatus{$key}{$snmpLocIfDescr} =~ /^$description/) { $match_descr = 1; }
+					if (defined ($ifStatus{$key}{$snmpLocIfDescr}) && $ifStatus{$key}{$snmpLocIfDescr} =~ /^$description/) { $match_descr = 1; }
 				}
 				if ($match_descr == 0) {
 					# check only if interface type is not listed in %excluded