Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / cmk / gui / plugins / wato / check_parameters / win_dhcp_pools.py
blobceb09ae67849b13865c8e241f3cbebc8e3f56627
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 Alternative,
30 Checkbox,
31 Dictionary,
32 Integer,
33 Percentage,
34 TextAscii,
35 Transform,
36 Tuple,
38 from cmk.gui.plugins.wato import (
39 RulespecGroupCheckParametersApplications,
40 RulespecGroupCheckParametersDiscovery,
41 register_check_parameters,
42 register_rule,
45 register_rule(
46 RulespecGroupCheckParametersDiscovery,
47 varname="discovery_win_dhcp_pools",
48 title=_("Discovery of Windows DHCP Pools"),
49 valuespec=Dictionary(elements=[
50 ("empty_pools",
51 Checkbox(
52 title=_("Discovery of empty DHCP pools"),
53 label=_("Include empty pools into the monitoring"),
54 help=_("You can activate the creation of services for "
55 "DHCP pools, which contain no IP addresses."),
56 )),
57 ]),
58 match='dict',
61 register_check_parameters(
62 RulespecGroupCheckParametersApplications,
63 "win_dhcp_pools",
64 _("DHCP Pools for Windows and Linux"),
65 Transform(
66 Dictionary(
67 elements = [
68 ("free_leases",
69 Alternative(
70 title = _("Free leases levels"),
71 elements = [
72 Tuple(
73 title = _("Free leases levels in percent"),
74 elements = [
75 Percentage(title = _("Warning if below"), default_value = 10.0),
76 Percentage(title = _("Critical if below"), default_value = 5.0)
79 Tuple(
80 title = _("Absolute free leases levels"),
81 elements = [
82 Integer(title = _("Warning if below"), unit = _("free leases")),
83 Integer(title = _("Critical if below"), unit = _("free leases"))
89 ("used_leases",
90 Alternative(
91 title = _("Used leases levels"),
92 elements = [
93 Tuple(
94 title = _("Used leases levels in percent"),
95 elements = [
96 Percentage(title = _("Warning if below")),
97 Percentage(title = _("Critical if below"))
100 Tuple(
101 title = _("Absolute used leases levels"),
102 elements = [
103 Integer(title = _("Warning if below"), unit = _("used leases")),
104 Integer(title = _("Critical if below"), unit = _("used leases"))
112 forth = lambda params: isinstance(params, tuple) and {"free_leases" : (float(params[0]), float(params[1]))} or params,
114 TextAscii(
115 title = _("Pool name"),
116 allow_empty = False,
118 match_type = "first",)