diff --git a/debian/patches/10_check_snmp_storage_error_handling b/debian/patches/10_check_snmp_storage_error_handling new file mode 100644 index 0000000..86a0515 --- /dev/null +++ b/debian/patches/10_check_snmp_storage_error_handling @@ -0,0 +1,42 @@ +From e7472bfb2a39f3536350642b177e5f9e17c5c369 Mon Sep 17 00:00:00 2001 +From: Louis Sautier +Date: Mon, 29 Jan 2018 09:17:25 +0100 +Subject: [PATCH] check_snmp_storage: fix SNMP error handling, see #33 + +--- + plugins/check_snmp_storage.pl | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl +index 2325acc..3593f79 100755 +--- a/plugins/check_snmp_storage.pl ++++ b/plugins/check_snmp_storage.pl +@@ -598,6 +598,15 @@ sub check_options { + $result = $session->get_request(@oids); + } else { + $result = $session->get_request(Varbindlist => \@oids); ++} ++ ++if (!defined($result)) { ++ printf("ERROR getting OIDs: %s.\n", $session->error); ++ $session->close; ++ exit $ERRORS{"UNKNOWN"}; ++} ++ ++if (version->parse(Net::SNMP->VERSION) >= 4) { + foreach my $key (sort keys %$result) { + + # Fix for filesystems larger 2 TB. More than 2 TB will cause an error because +@@ -613,12 +622,6 @@ sub check_options { + } + } + +-if (!defined($result)) { +- printf("ERROR: Size table :%s.\n", $session->error); +- $session->close; +- exit $ERRORS{"UNKNOWN"}; +-} +- + $session->close; + + # Only a few ms left... diff --git a/debian/patches/series b/debian/patches/series index d738d0c..d2cca2f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ +10_check_snmp_storage_error_handling 50_disable_epn 51_fix_privacy_doc