Module: check_mk
Branch: master
Commit: cafe3a00c6cf6b8911224ec67a7f5553a843dabb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cafe3a00c6cf6b…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu May 11 14:44:55 2017 +0200
4653 websphere_mq_channels: Added percent levels for messages
Change-Id: I4b8a0d7fd62d8d27f7ffaedca6e06905c26127d1
---
.werks/4653 | 10 ++++++++++
checks/websphere_mq_channels | 20 +++++++++++++++++++-
web/plugins/wato/check_parameters.py | 32 ++++++++++++++++----------------
3 files changed, 45 insertions(+), 17 deletions(-)
diff --git a/.werks/4653 b/.werks/4653
new file mode 100644
index 0000000..f3e5793
--- /dev/null
+++ b/.werks/4653
@@ -0,0 +1,10 @@
+Title: websphere_mq_channels: Added percent levels for messages
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1494506668
+Class: feature
+
+
diff --git a/checks/websphere_mq_channels b/checks/websphere_mq_channels
index b179a82..edb4d58 100644
--- a/checks/websphere_mq_channels
+++ b/checks/websphere_mq_channels
@@ -38,7 +38,7 @@
factory_settings["websphere_mq_channels_default_levels"] = {
- 'message_count': ( 900, 1000 ),
+ 'message_count' : ( 900, 1000 ),
'status': {
'RUNNING': 0,
'STOPPED': 1
@@ -101,8 +101,26 @@ def check_websphere_mq_channels(item, params, parsed):
infotext += " (warn crit at %d/%d messages)" % (warn, crit)
else:
warn, crit = None, None
+
yield state, infotext, [('messages', messages, warn, crit, 0,
max_messages)]
+ if params.get("message_count_perc"):
+ warn, crit = params["message_count_perc"]
+ messages_perc = 1.0 * messages / max_messages
+ infotext = get_percent_human_readable(messages_perc)
+ state = 0
+
+ if messages_perc >= crit:
+ state = 2
+ elif messages_perc >= warn:
+ state = 1
+ if state > 0:
+ infotext += " (warn/crit at %s/%s)" % (
+ get_percent_human_readable(warn),
+ get_percent_human_readable(crit))
+
+ yield state, infotext
+
check_info["websphere_mq_channels"] = {
"parse_function" : parse_websphere_mq_channels,
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 6d37aa8..ac14f9f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1756,6 +1756,22 @@ websphere_mq_common_elements = [
default_value = (1000, 1200)
)
),
+ ("message_count_perc",
+ OptionalDropdownChoice(
+ title = _('Percentage of queue length'),
+ help = _('This setting only applies if the WebSphere MQ reports the
queue length'),
+ choices = [ (None, _("Ignore these levels")) ],
+ otherlabel = _("Set relative levels"),
+ explicit = \
+ Tuple(
+ title = _('Percentage of queue length'),
+ elements = [
+ Percentage(title = _("Warning at")),
+ Percentage(title = _("Critical at")),
+ ]
+ ),
+ default_value = (80.0, 90.0)
+ )),
]
def transform_websphere_mq_queues(source):
@@ -1779,22 +1795,6 @@ register_check_parameters(
Transform(
Dictionary(
elements = websphere_mq_common_elements + [
- ("message_count_perc",
- OptionalDropdownChoice(
- title = _('Percentage of queue length'),
- help = _('This setting only applies if the WebSphere MQ
reports the queue length'),
- choices = [ (None, _("Ignore these levels")) ],
- otherlabel = _("Set relative levels"),
- explicit = \
- Tuple(
- title = _('Percentage of queue length'),
- elements = [
- Percentage(title = _("Warning at")),
- Percentage(title = _("Critical at")),
- ]
- ),
- default_value = (80.0, 90.0)
- )),
("messages_not_processed",
Dictionary(
title = _("Settings for messages not processed"),