Refactoring: Moved rules from unsorted.py to matching modules (CMK-1393)
[check_mk.git] / cmk / gui / plugins / wato / check_parameters / msx_queues.py
blobd09d13c2781348edcfbcb565b693b1a023f47fd1
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 from cmk.gui.i18n import _
28 from cmk.gui.valuespec import (
29 Dictionary,
30 Integer,
31 ListOf,
32 TextAscii,
33 Transform,
34 Tuple,
36 from cmk.gui.plugins.wato import (
37 RulespecGroupCheckParametersApplications,
38 RulespecGroupCheckParametersDiscovery,
39 register_check_parameters,
40 register_rule,
44 def transform_msx_queues(params):
45 if isinstance(params, tuple):
46 return {"levels": (params[0], params[1])}
47 return params
50 register_rule(
51 RulespecGroupCheckParametersDiscovery,
52 varname="winperf_msx_queues_inventory",
53 title=_('MS Exchange Message Queues Discovery'),
54 help=_(
55 'Per default the offsets of all Windows performance counters are preconfigured in the check. '
56 'If the format of your counters object is not compatible then you can adapt the counter '
57 'offsets manually.'),
58 valuespec=ListOf(
59 Tuple(
60 orientation="horizontal",
61 elements=[
62 TextAscii(
63 title=_("Name of Counter"),
64 help=_("Name of the Counter to be monitored."),
65 size=50,
66 allow_empty=False,
68 Integer(
69 title=_("Offset"),
70 help=_("The offset of the information relative to counter base"),
71 allow_empty=False,
73 ]),
74 movable=False,
75 add_label=_("Add Counter")),
76 match='all',
79 register_check_parameters(
80 RulespecGroupCheckParametersApplications, "msx_queues", _("MS Exchange Message Queues"),
81 Transform(
82 Dictionary(
83 title=_("Set Levels"),
84 elements=[
85 ('levels',
86 Tuple(
87 title=_("Maximum Number of E-Mails in Queue"),
88 elements=[
89 Integer(title=_("Warning at"), unit=_("E-Mails")),
90 Integer(title=_("Critical at"), unit=_("E-Mails"))
91 ])),
92 ('offset',
93 Integer(
94 title=_("Offset"),
95 help=
96 _("Use this only if you want to overwrite the postion of the information in the agent "
97 "output. Also refer to the rule <i>Microsoft Exchange Queues Discovery</i> "
98 ))),
100 optional_keys=["offset"],
102 forth=transform_msx_queues,
104 TextAscii(
105 title=_("Explicit Queue Names"),
106 help=_("Specify queue names that the rule should apply to"),
107 ), "first")