Module: check_mk
Branch: master
Commit: c3604e4cc18653eda0c65edbc1e3b59eda14c3ca
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c3604e4cc18653…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Sep 27 14:49:08 2018 +0200
6769 FIX genua_fan genua_pfstate: Fixed crashing discovery on empty data
Change-Id: I3f8be2d4bb6790dc5c4ec8eced017e48843d51f2
---
.werks/6769 | 10 ++++++++++
checks/genua_fan | 3 +++
checks/genua_pfstate | 10 +++++-----
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/.werks/6769 b/.werks/6769
new file mode 100644
index 0000000..b65e7b7
--- /dev/null
+++ b/.werks/6769
@@ -0,0 +1,10 @@
+Title: genua_fan genua_pfstate: Fixed crashing discovery on empty data
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1538052524
+Class: fix
+
+
diff --git a/checks/genua_fan b/checks/genua_fan
index 8d5d2b1..f70cf00 100644
--- a/checks/genua_fan
+++ b/checks/genua_fan
@@ -35,6 +35,9 @@ def inventory_genua_fan(info):
# remove empty elements due to alternative enterprise id in snmp_info
info = filter(None, info)
+ if not info:
+ return
+
inventory = []
for _fanNo, fanName, _fanRPM, _fanState in info[0]:
inventory.append( (fanName, {}) )
diff --git a/checks/genua_pfstate b/checks/genua_pfstate
index b4f9590..78cbea1 100644
--- a/checks/genua_pfstate
+++ b/checks/genua_pfstate
@@ -36,11 +36,11 @@ def inventory_genua_pfstate(info):
# remove empty elements due to alternative enterprise id in snmp_info
info = filter(None, info)
- if info[0]:
- if len(info[0][0]) == 3:
- return [ (None, genua_pfstate_default_levels) ]
- else:
- return []
+ if not info or not info[0]:
+ return
+
+ if len(info[0][0]) == 3:
+ return [ (None, genua_pfstate_default_levels) ]
def pfstate(st):