Module: check_mk
Branch: master
Commit: 1c35f9eb6dde3b73fa5616c4b22b24987c7dc289
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1c35f9eb6dde3b…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Feb 19 16:28:04 2016 +0100
#2996 websphere_mq_queues: now able to configure levels for used percentage of total
queues
---
.werks/2996 | 10 +++++++++
ChangeLog | 1 +
checks/websphere_mq_queues | 37 +++++++++++++++++++++++++++-------
web/plugins/wato/check_parameters.py | 9 +++++++++
4 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/.werks/2996 b/.werks/2996
new file mode 100644
index 0000000..801323a
--- /dev/null
+++ b/.werks/2996
@@ -0,0 +1,10 @@
+Title: websphere_mq_queues: now able to configure levels for used percentage of total
queues
+Level: 1
+Component: checks
+Class: feature
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1455895659
+
+
diff --git a/ChangeLog b/ChangeLog
index c4ab363..7b969e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
* 2994 brocade.temp: increased temperature default levels from 35/40 to 55/60
* 3078 mssql_transactionlogs: new check to monitor the size of mssql transaction
logs
* 2995 esx_vsphere_licenses: now compatible with esx 6.0...
+ * 2996 websphere_mq_queues: now able to configure levels for used percentage of total
queues
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/checks/websphere_mq_queues b/checks/websphere_mq_queues
index 5204980..f39d1f6 100644
--- a/checks/websphere_mq_queues
+++ b/checks/websphere_mq_queues
@@ -40,7 +40,8 @@
# 0 CD.ISS.VWD.REPLY.C000052
websphere_mq_queues_default_levels = {
- 'message_count': ( 1000, 1200 )
+ 'message_count' : ( 1000, 1200 ),
+ 'message_count_perc': ( 80.0, 90.0 )
}
def inventory_websphere_mq_queues(info):
@@ -48,12 +49,14 @@ def inventory_websphere_mq_queues(info):
def check_websphere_mq_queues(item, params, info):
if isinstance(params, tuple):
- params = {'message_count': params}
+ params = {'message_count': params,
+ 'message_count_perc':
websphere_mq_queues_default_levels["message_count_perc"]}
for line in info:
queue = line[1]
if queue == item:
messages = int(line[0])
+ queue_length = None
if len(line) >= 3:
queue_length = int(line[2])
length_info = "/%d" % queue_length
@@ -62,12 +65,32 @@ def check_websphere_mq_queues(item, params, info):
message = "%d%s messages in queue" % ( messages, length_info )
warn, crit = params['message_count']
- perf = [ ( "queue", messages, warn, crit ) ]
+ perf = [ ( "queue", messages, warn, crit, None, queue_length ) ]
+
+ state = 0
+ levels_info = []
if messages >= crit:
- return 2, message, perf
- if messages >= warn:
- return 1, message, perf
- return 0, message, perf
+ state = 2
+ elif messages >= warn:
+ state = 1
+ if state:
+ levels_info.append("Levels at %s/%s" %
params["message_count"])
+
+ if queue_length:
+ warn_perc, crit_perc = params['message_count_perc']
+ used_perc = messages / float(queue_length) * 100
+ perc_state = 0
+ if used_perc >= crit_perc:
+ perc_state = 2
+ elif used_perc >= warn_perc:
+ perc_state = 1
+ if perc_state:
+ levels_info.append("Levels at %s%%/%s%%" %
params["message_count_perc"])
+
+ levels_text = ""
+ if levels_info:
+ levels_text = ", (%s)" % ", ".join(levels_info)
+ return max(state, perc_state), message + levels_text, perf
check_info["websphere_mq_queues"] = {
"group" : "websphere_mq",
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 26f99d6..6cf9cf3 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -328,6 +328,15 @@ register_check_parameters(
Integer(title = _("Critical at"), default_value = 1200
),
]
)),
+ ("message_count_perc",
+ Tuple(
+ title = _('Percentage of Queue Length'),
+ help = _('This setting only applies if the WebSphere MQ reports
the queue length'),
+ elements = [
+ Percentage(title = _("Warning at"), default_value =
80.0 ),
+ Percentage(title = _("Critical at"), default_value =
90.0 ),
+ ]
+ )),
("status",
Dictionary(
title = _('Override check state based on channel state (only for
channels)'),