Module: check_mk
Branch: master
Commit: ea10275ea58c5c883031aa88fcbf733a9f8abc56
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ea10275ea58c5c…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Sep 2 13:31:23 2014 +0200
winperf_msx_queues: Fixed new feature from yesterday
---
checks/winperf_msx_queues | 27 ++++++++++++++---
web/plugins/wato/check_parameters.py | 54 ++++++++++++++++++++++++----------
2 files changed, 61 insertions(+), 20 deletions(-)
diff --git a/checks/winperf_msx_queues b/checks/winperf_msx_queues
index c7a8f18..d7bfc21 100644
--- a/checks/winperf_msx_queues
+++ b/checks/winperf_msx_queues
@@ -54,7 +54,10 @@
# 6 0 0 0 0 rawcount
# Default warn/crit levels for length of queues
-msx_queues_default_levels = (500, 2000)
+factory_settings['winperf_msx_queues'] = {
+ 'levels': ( 500, 2000 ),
+}
+
# Queues to be inventorized (number are relative to counter base)
winperf_msx_queues = {
@@ -76,16 +79,31 @@ def inventory_winperf_msx_queues(info):
# In case that rules for this host are set,
# only use this rules
if inventory_rules:
- winperf_msx_queues = inventory_rules
- return [ (name, "msx_queues_default_levels") for name in
winperf_msx_queues ]
+ queues = inventory_rules
+ else:
+ queues = winperf_msx_queues
+ return [ (name, { "offset" : offset } ) for name, offset in
queues.items() ]
def check_winperf_msx_queues(item, params, info):
num_instances = int(info[1][0])
if num_instances < 1:
return (3, "no counters available, transport service running?")
+
+ # Old default case:
+ if type(params) == tuple:
+ warn, crit = params
+ offset = winperf_msx_queues.get(item)
+ else:
+ warn, crit = params['levels']
+ if params['offset']:
+ offset = str(params['offset'])
+ # If no offset is set, we assume that still the default counters are used
+ else:
+ offset = winperf_msx_queues.get(item)
+
for line in info[2:]:
- if line[0] == winperf_msx_queues.get(item):
+ if line[0] == offset:
length = int(line[-2])
warn, crit = params
perfdata = [("length", length, warn, crit)]
@@ -106,5 +124,6 @@ check_info["winperf_msx_queues"] = {
'inventory_function': inventory_winperf_msx_queues,
'service_description': 'Queue %s',
'has_perfdata': True,
+ "default_levels_variable" : "winperf_msx_queues",
'group': 'msx_queues',
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 82be425..8379241 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1772,27 +1772,46 @@ register_check_parameters(
has_inventory = False,
)
+def transform_msx_queues(params):
+ if type(params) == tuple:
+ return { "levels" : ( params[0], params[1] ) }
+ return params
+
+
register_check_parameters(
subgroup_applications,
"msx_queues",
_("MS Exchange Message Queues"),
- Tuple(
- help = _("This rule applies to the number of E-Mails in the various Exchange
Message Queues"),
- elements = [
- Integer(title = _("Warning if above"), unit =
_("E-Mails")),
- Integer(title = _("Critical if above"), unit =
_("E-Mails"))
- ]),
- OptionalDropdownChoice(
+ Transform(
+ Dictionary(
+ title = _("Set Levels"),
+ elements = [
+ ( 'levels',
+ Tuple(
+ title = _("Maximum Number of E-Mails in
Queue"),
+ help = _("This rule applies to the number of E-Mails
in the various Exchange Message Queues"),
+ elements = [
+ Integer(title = _("Warning if above"), unit
= _("E-Mails")),
+ Integer(title = _("Critical if above"),
unit = _("E-Mails"))
+ ]),
+ ),
+ ('offset',
+ Integer(
+ title = _("Offset"),
+ help = _("Use this only if you want to overwrite the
postion of the information in the agent "
+ "Output. Also refer to the rule
<i>Microsoft Exchange Queues Inventory</i> ")
+ )
+ ),
+ ],
+ optional_keys = [ "offset" ],
+ ),
+ back = transform_msx_queues,
+ forth = transform_msx_queues,
+ ),
+ TextAscii(
title = _("Explicit Queue Names"),
- help = _("Select queue names that the rule should apply"),
- choices = [
- ( "Active Remote Delivery", _("Active Remote Delivery")
),
- ( "Retry Remote Delivery", _("Retry Remote Delivery")
),
- ( "Active Mailbox Delivery", _("Active Mailbox Delivery")
),
- ( "Poison Queue Length", _("Poison Queue Length") ),
- ],
- otherlabel = _("specify manually ->"),
- explicit = TextAscii(allow_empty = False)),
+ help = _("Specify queue names that the rule should apply"),
+ ),
"first"
)
@@ -3979,10 +3998,12 @@ register_rule(group + '/' + subgroup_inventory,
'To do that, knowledge about the Agent Output is needed. '),
valuespec = ListOf(
Tuple(
+ orientation = "horizontal",
elements = [
TextAscii(
title = _("Name of Counter"),
help = _("Name of the Counter to be
monitored."),
+ size = 50,
allow_empty = False,
),
Integer(
@@ -3991,6 +4012,7 @@ register_rule(group + '/' + subgroup_inventory,
allow_empty = False,
),
]),
+ movable = False,
add_label = _("Add Counter")),
match = 'all',
)