Module: check_mk
Branch: master
Commit: bfdb188d53d2dbc42a17fcfbfdc23f6865ac3547
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bfdb188d53d2db…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Apr 27 14:53:01 2018 +0200
5994 FIX inv_if: Fixed failing scan function if device returns no data for OID
'.1.3.6.1.2.1.2.1.0'
Change-Id: I72fff6f9ba6c82d0b5236c1e40b0e9a00a3e5194
---
.werks/5994 | 11 +++++++++++
inventory/if | 9 ++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/.werks/5994 b/.werks/5994
new file mode 100644
index 0000000..6ae885b
--- /dev/null
+++ b/.werks/5994
@@ -0,0 +1,11 @@
+Title: inv_if: Fixed failing scan function if device returns no data for OID
'.1.3.6.1.2.1.2.1.0'
+Level: 1
+Component: inv
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1524833303
+
+
diff --git a/inventory/if b/inventory/if
index 97657aa..4bef0ed 100644
--- a/inventory/if
+++ b/inventory/if
@@ -25,6 +25,13 @@
# Boston, MA 02110-1301 USA.
+def scan_inv_if(oid):
+ try:
+ return int(oid(".1.3.6.1.2.1.2.1.0")) >= 2
+ except ValueError:
+ return False
+
+
# TODO unify with other if inventory plugins
def inv_if(info, params):
def round_to_day(ts):
@@ -133,6 +140,6 @@ 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,
+ 'snmp_scan_function': scan_inv_if,
'includes': ['if.include', 'uptime.include'],
}