Module: check_mk
Branch: master
Commit: a3f2496e8e4d2c267c98d7ad80de45d417ec0b00
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a3f2496e8e4d2c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jul 24 15:49:02 2014 +0200
1050 FIX websphere_mq_queues: make compatible with old agent, fix not-found case
---
.werks/1050 | 8 ++++++++
ChangeLog | 1 +
checks/websphere_mq_queues | 35 +++++++++++++++++++++++++---------
web/plugins/wato/check_parameters.py | 4 ++--
4 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/.werks/1050 b/.werks/1050
new file mode 100644
index 0000000..74fb9ff
--- /dev/null
+++ b/.werks/1050
@@ -0,0 +1,8 @@
+Title: websphere_mq_queues: make compatible with old agent, fix not-found case
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1406209719
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 348e787..68f6b22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -73,6 +73,7 @@
* 1087 FIX: Active checks: Non-ascii check commands now converted into utf-8...
* 1049 FIX: ups_capacity: Fix exception when running on battery...
* 0639 FIX: jolokia_metrics: fix for problem when catalina uses the standalone
engine
+ * 1050 FIX: websphere_mq_queues: make compatible with old agent, fix not-found case
Multisite:
* 1013 Sort host names naturally, e.g. foobar11 comes after foobar2...
diff --git a/checks/websphere_mq_queues b/checks/websphere_mq_queues
index 087c118..00f7239 100644
--- a/checks/websphere_mq_queues
+++ b/checks/websphere_mq_queues
@@ -24,12 +24,20 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-#<<<websphere_mq_queues>>>
-#0 CD.ISS.CATSOS.REPLY.C000052 5000
-#0 CD.ISS.COBA.REPLY.C000052 5000
-#0 CD.ISS.DEUBA.REPLY.C000052 5000
-#0 CD.ISS.TIQS.REPLY.C000052 5000
-#0 CD.ISS.VWD.REPLY.C000052 5000
+# <<<websphere_mq_queues>>>
+# 0 CD.ISS.CATSOS.REPLY.C000052 5000
+# 0 CD.ISS.COBA.REPLY.C000052 5000
+# 0 CD.ISS.DEUBA.REPLY.C000052 5000
+# 0 CD.ISS.TIQS.REPLY.C000052 5000
+# 0 CD.ISS.VWD.REPLY.C000052 5000
+
+# Old output
+# <<<websphere_mq_queues>>>
+# 0 CD.ISS.CATSOS.REPLY.C000052
+# 0 CD.ISS.COBA.REPLY.C000052
+# 0 CD.ISS.DEUBA.REPLY.C000052
+# 0 CD.ISS.TIQS.REPLY.C000052
+# 0 CD.ISS.VWD.REPLY.C000052
websphere_mq_queues_default_levels = ( 1000, 1200 )
@@ -37,11 +45,18 @@ def inventory_websphere_mq_queues(info):
return [ ( x[1], 'websphere_mq_queues_default_levels' ) for x in info ]
def check_websphere_mq_queues(item, params, info):
- for messages, queue, queue_length in info:
+ for line in info:
+ queue = line[1]
if queue == item:
+ messages = int(line[0])
+ if len(line) >= 3:
+ queue_length = int(line[2])
+ length_info = "/%d" % queue_length
+ else:
+ length_info = ""
+ message = "%d%s messages in queue" % ( messages, length_info )
+
warn, crit = params
- messages = saveint(messages)
- message = "%d/%s Messages in Queue" % ( messages, queue_length )
perf = [ ( "queue", messages, warn, crit ) ]
if messages >= crit:
return 2, message, perf
@@ -49,6 +64,8 @@ def check_websphere_mq_queues(item, params, info):
return 1, message, perf
return 0, message, perf
+ return 3, "No message queue named %s in agent output" % item
+
check_info["websphere_mq_queues"] = {
"group" : "websphere_mq",
"check_function" : check_websphere_mq_queues,
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 2b49628..3f5fee7 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -530,8 +530,8 @@ register_check_parameters(
Tuple(
title = _('Maximum number of messages'),
elements = [
- Integer(title = _("Warning if above") ),
- Integer(title = _("Critical if above") ),
+ Integer(title = _("Warning if above"), default_value = 1000 ),
+ Integer(title = _("Critical if above"), default_value = 1200 ),
]
),
TextAscii(title = _("Name of Channel or Queue")),