Module: check_mk
Branch: master
Commit: d12417a78e9622ba9044ceeb3cc6bc4b61ba4651
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d12417a78e9622…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 20 13:21:16 2016 +0100
Improved error handling for SNMP devices without system object OID
---
modules/discovery.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/modules/discovery.py b/modules/discovery.py
index eef62d5..cee7b52 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -636,10 +636,15 @@ def snmp_scan(hostname, ipaddress, on_error = "ignore",
for_inv=False):
vverbose(" SNMP scan:\n")
if not in_binary_hostlist(hostname, snmp_without_sys_descr):
- sys_descr_oid = ".1.3.6.1.2.1.1.1.0"
- sys_descr = get_single_oid(hostname, ipaddress, sys_descr_oid)
- if sys_descr == None:
- raise MKSNMPError("Cannot fetch system description OID %s" %
sys_descr_oid)
+ for oid, name in [ (".1.3.6.1.2.1.1.1.0", "system
description"),
+ (".1.3.6.1.2.1.1.2.0", "system object")
]:
+ value = get_single_oid(hostname, ipaddress, oid)
+ if value == None:
+ raise MKSNMPError(
+ "Cannot fetch %s OID %s. This might be OK for some bogus
devices. "
+ "In that case please configure the ruleset \"Hosts without
system "
+ "description OID\" to tell Check_MK not to fetch the system
"
+ "description and system object OIDs." % (name, oid))
else:
# Fake OID values to prevent issues with a lot of scan functions
vverbose(" Skipping system description OID "