From 55ccc3a08121c3f181c8fce8fe696023f8cd2f3f Mon Sep 17 00:00:00 2001 From: Michal Svamberg Date: Sun, 31 May 2015 02:01:25 +0200 Subject: [PATCH] Fix non-existent items in SNMP v2c for SHELF test Non existent items returns SNMPv1 and SNMPv2c different. In SNMPv1 return as empty string but SNMPv2c return string with 'noSuchInstance'. --- nagios/check-netapp-ng.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nagios/check-netapp-ng.pl b/nagios/check-netapp-ng.pl index 290a410..7d6b5b8 100755 --- a/nagios/check-netapp-ng.pl +++ b/nagios/check-netapp-ng.pl @@ -878,8 +878,7 @@ if("$opt{'check_type'}" eq "TEMP") { foreach my $subkey ( keys %shelf) { - if ( $shelf{$subkey} ne "" ) { - print "$subkey->$shelf{$subkey} "; + if ( ($shelf{$subkey} ne "") and ($shelf{$subkey} ne "noSuchInstance") ) { if ( "$subkey" eq "CurrentTemp" ) { $shelf{$subkey} =~ m/^([0-9]+)C.*$/; $perf_temp = "$perf_temp, temp_$shelf{'ShelfNumber'}=$1"; @@ -889,7 +888,7 @@ if("$opt{'check_type'}" eq "TEMP") { { print "$subkey->"; print "None "; } if ("$opt{'check_type'}" eq "SHELF") { - if($shelf{$subkey}) { push(@shelf_err,"$addr $subkey,") } + if(($shelf{$subkey} ne "") and ($shelf{$subkey} ne "noSuchInstance")) { push(@shelf_err,"$addr $subkey,") } } }