Module: check_mk
Branch: master
Commit: 5462bef7103f9aceec36c41481fa4e07458f4244
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5462bef7103f9a…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri May 18 10:39:26 2018 +0200
6083 FIX websphere_mq_instance: Fixed crash if no standby status is reported
Change-Id: If4bcef077b1c13d17c58528304332434ee8411d0
---
.werks/6083 | 10 ++++++++++
checks/websphere_mq_instance | 16 +++++++++-------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/.werks/6083 b/.werks/6083
new file mode 100644
index 0000000..a317e2a
--- /dev/null
+++ b/.werks/6083
@@ -0,0 +1,10 @@
+Title: websphere_mq_instance: Fixed crash if no standby status is reported
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1526632737
+Class: fix
+
+
diff --git a/checks/websphere_mq_instance b/checks/websphere_mq_instance
index 5f530d6..6c2d300 100644
--- a/checks/websphere_mq_instance
+++ b/checks/websphere_mq_instance
@@ -175,9 +175,10 @@ def inventory_websphere_mq_manager(parsed):
def check_websphere_mq_manager(item, params, parsed):
if item in parsed["manager"]:
data = parsed["manager"][item]
+ pprint.pprint(data)
status = data["STATUS"]
default = data["DEFAULT"]
- standby = data["STANDBY"]
+ standby = data.get("STANDBY", "")
installation_name = data.get("INSTNAME")
installation_path = data.get("INSTPATH")
installation_version = data.get("INSTVER")
@@ -190,28 +191,29 @@ def check_websphere_mq_manager(item, params, parsed):
yield get_websphere_mq_status("manager", status, params), \
'Status: %s' % status.lower()
- extra_info = ""
+ standby_info = standby.lower()
if standby.startswith("Not"):
if len(instances_modes) == 1:
state = 0
- extra_info += " (standalone)"
+ standby_info += " (standalone)"
else:
state = 1
- extra_info += " (standalone but %d instances)" %
len(instances_modes)
+ standby_info += " (standalone but %d instances)" %
len(instances_modes)
elif standby == "Permitted":
if instances_modes in [ [ "Active", "Standby" ], [
"Standby", "Active" ] ]:
state = 0
else:
state = 1
- extra_info += " (Missing partner)"
+ standby_info += " (Missing partner)"
else:
state = 1
- extra_info += " (unknown)"
+ standby_info += " (unknown)"
if "map_instance_states" in params:
state = get_websphere_mq_status("standby", standby, params)
- yield state, "Status: %s%s, Default: %s" % (standby.lower(),
extra_info, default)
+ yield state, "Standby: %s" % standby_info.strip()
+ yield 0, "Default: %s" % data["DEFAULT"]
for what, title in [ (installation_name, "Name"),
(installation_path, "Path"),