Module: check_mk
Branch: master
Commit: db5ed583a791b6d15a97e00ffdddd7e010344314
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=db5ed583a791b6…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Thu Jan 11 16:51:39 2018 +0100
5489 FIX pvecm_status: Fix parsing of agent output that could lead to a crash
Change-Id: Ibcb5c8a0a78f672ee140139b3893a07367bb7523
---
.werks/5489 | 10 ++++++++++
checks/pvecm_status | 12 ++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/.werks/5489 b/.werks/5489
new file mode 100644
index 0000000..3317238
--- /dev/null
+++ b/.werks/5489
@@ -0,0 +1,10 @@
+Title: pvecm_status: Fix parsing of agent output that could lead to a crash
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1515685777
+Class: fix
+
+
diff --git a/checks/pvecm_status b/checks/pvecm_status
index 9ddae92..7c87fb3 100644
--- a/checks/pvecm_status
+++ b/checks/pvecm_status
@@ -77,7 +77,11 @@ def inventory_pvecm_status(info):
def check_pvecm_status(_no_item, _no_params, info):
parsed = {}
- for what, value in info:
+ for line in info:
+ if len(line) != 2:
+ continue
+ what, value = line
+
parsed[what.lower()] = value.strip().lower()
if "cman_tool" in parsed and \
@@ -85,8 +89,12 @@ def check_pvecm_status(_no_item, _no_params, info):
yield 2, "Cluster management tool: %s" % parsed["cman_tool"]
else:
+ name = parsed.get("cluster name",
+ parsed.get("quorum provider",
+ "unknown"))
+
yield 0, "Name: %s, Nodes: %s" % \
- (parsed["cluster name"], parsed["nodes"])
+ (name, parsed["nodes"])
if "activity blocked" in parsed["quorum"]:
yield 2, "Quorum: %s" % parsed["quorum"]