Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / cmk / gui / plugins / wato / check_parameters / fcp.py
bloba6f54a409fc9de7d2fb886a8a671cb8355c10bae
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 CascadingDropdown,
30 Dictionary,
31 OptionalDropdownChoice,
32 Integer,
33 ListOf,
34 Percentage,
35 TextAscii,
36 Tuple,
38 from cmk.gui.plugins.wato import (
39 Levels,
40 PredictiveLevels,
41 RulespecGroupCheckParametersNetworking,
42 register_check_parameters,
46 def vs_interface_traffic():
47 def vs_abs_perc():
48 return CascadingDropdown(
49 orientation="horizontal",
50 choices=[("perc", _("Percentual levels (in relation to port speed)"),
51 Tuple(
52 orientation="float",
53 show_titles=False,
54 elements=[
55 Percentage(label=_("Warning at")),
56 Percentage(label=_("Critical at")),
57 ])),
58 ("abs", _("Absolute levels in bits or bytes per second"),
59 Tuple(
60 orientation="float",
61 show_titles=False,
62 elements=[
63 Integer(label=_("Warning at")),
64 Integer(label=_("Critical at")),
65 ])), ("predictive", _("Predictive Levels"), PredictiveLevels())])
67 return CascadingDropdown(
68 orientation="horizontal",
69 choices=[
70 ("upper", _("Upper"), vs_abs_perc()),
71 ("lower", _("Lower"), vs_abs_perc()),
75 register_check_parameters(
76 RulespecGroupCheckParametersNetworking,
77 "fcp",
78 _("Fibrechannel Interfaces"),
79 Dictionary(elements=[
80 ("speed",
81 OptionalDropdownChoice(
82 title=_("Operating speed"),
83 help=_("If you use this parameter then the check goes warning if the "
84 "interface is not operating at the expected speed (e.g. it "
85 "is working with 8Gbit/s instead of 16Gbit/s)."),
86 choices=[
87 (None, _("ignore speed")),
88 (4000000000, "4 Gbit/s"),
89 (8000000000, "8 Gbit/s"),
90 (16000000000, "16 Gbit/s"),
92 otherlabel=_("specify manually ->"),
93 explicit=Integer(
94 title=_("Other speed in bits per second"), label=_("Bits per second")))),
95 ("traffic",
96 ListOf(
97 CascadingDropdown(
98 title=_("Direction"),
99 orientation="horizontal",
100 choices=[
101 ('both', _("In / Out"), vs_interface_traffic()),
102 ('in', _("In"), vs_interface_traffic()),
103 ('out', _("Out"), vs_interface_traffic()),
105 title=_("Used bandwidth (minimum or maximum traffic)"),
106 help=_("Setting levels on the used bandwidth is optional. If you do set "
107 "levels you might also consider using averaging."),
109 ("read_latency",
110 Levels(
111 title=_("Read latency"),
112 unit=_("ms"),
113 default_value=None,
114 default_levels=(50.0, 100.0))),
115 ("write_latency",
116 Levels(
117 title=_("Write latency"),
118 unit=_("ms"),
119 default_value=None,
120 default_levels=(50.0, 100.0))),
121 ("latency",
122 Levels(
123 title=_("Overall latency"),
124 unit=_("ms"),
125 default_value=None,
126 default_levels=(50.0, 100.0))),
128 TextAscii(title=_("Port specification"), allow_empty=False),
129 "dict",