Module: check_mk
Branch: master
Commit: 77ea977ebde78e0874a4ee4064877ac12efcc43d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=77ea977ebde78e…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Mon Sep 4 15:29:21 2017 +0200
5129 FIX fixed inventory plugin detection for SNMP devices
Fixes a problem with the HW/SW inventory of SNMP devices
that resulted in too few entries.
Change-Id: Ib02f65fe56ce6a6a4d8f0a28427eb65892e2399c
---
.werks/5129 | 11 +++++++++++
cmk_base/agent_data.py | 2 +-
cmk_base/discovery.py | 4 ++--
inventory/if | 2 +-
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/.werks/5129 b/.werks/5129
new file mode 100644
index 0000000..b9c4409
--- /dev/null
+++ b/.werks/5129
@@ -0,0 +1,11 @@
+Title: fixed inventory plugin detection for SNMP devices
+Level: 1
+Component: inv
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1504531045
+Class: fix
+
+Fixes a problem with the HW/SW inventory of SNMP devices
+that resulted in too few entries.
diff --git a/cmk_base/agent_data.py b/cmk_base/agent_data.py
index 5d6ffb5..15f874a 100644
--- a/cmk_base/agent_data.py
+++ b/cmk_base/agent_data.py
@@ -219,7 +219,7 @@ def get_realhost_info(hostname, ipaddress, check_type, max_cache_age,
info_type = check_type.split(".")[0]
if info_type in checks.snmp_info:
oid_info = checks.snmp_info[info_type]
- elif info_type in "inventory_plugins" in sys.modules:
+ elif info_type in inventory_plugins.inv_info:
oid_info = inventory_plugins.inv_info[info_type].get("snmp_info")
else:
oid_info = None
diff --git a/cmk_base/discovery.py b/cmk_base/discovery.py
index 550f914..9d6364d 100644
--- a/cmk_base/discovery.py
+++ b/cmk_base/discovery.py
@@ -818,7 +818,7 @@ def snmp_scan(hostname, ipaddress, on_error = "ignore",
for_inv=False):
else:
if for_inv and not inventory_plugins.is_snmp_plugin(check_type):
continue
- elif not checks.is_snmp_check(check_type):
+ elif not for_inv and not checks.is_snmp_check(check_type):
continue
basename = check_type.split(".")[0]
@@ -830,7 +830,7 @@ def snmp_scan(hostname, ipaddress, on_error = "ignore",
for_inv=False):
scan_function = checks.snmp_scan_functions[check_type]
elif basename in checks.snmp_scan_functions:
scan_function = checks.snmp_scan_functions[basename]
- elif "inventory_plugins" in sys.modules and basename in
inventory_plugins.inv_info:
+ elif basename in inventory_plugins.inv_info:
scan_function =
inventory_plugins.inv_info[basename].get("snmp_scan_function")
else:
scan_function = None
diff --git a/inventory/if b/inventory/if
index dcc44f5..97657aa 100644
--- a/inventory/if
+++ b/inventory/if
@@ -134,5 +134,5 @@ inv_info['inv_if'] = {
( ".1.3.6.1.2.1.1", [ "3.0" ] ), # uptime
],
'snmp_scan_function': lambda oid: int(oid(".1.3.6.1.2.1.2.1.0"))
>= 2,
- 'includes': ['if.include'],
+ 'includes': ['if.include', 'uptime.include'],
}