Преглед изворни кода

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 година
родитељ
комит
de7ebf90c3
1 измењених фајлова са 1 додато и 1 уклоњено
  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