2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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 (
39 from cmk
.gui
.plugins
.wato
import (
40 RulespecGroupCheckParametersDiscovery
,
41 RulespecGroupCheckParametersEnvironment
,
42 register_check_parameters
,
47 def transform_ipmi_inventory_rules(p
):
48 if not isinstance(p
, dict):
50 if p
.get("summarize", True):
52 if p
.get('ignored_sensors', []):
53 return ('single', {'ignored_sensors': p
["ignored_sensors"]})
58 RulespecGroupCheckParametersDiscovery
,
59 varname
="inventory_ipmi_rules",
60 title
=_("Discovery of IPMI sensors"),
63 orientation
="vertical",
65 [("summarize", _("Summary")),
66 ("single", _("Single"),
72 title
=_("Ignore the following IPMI sensors"),
73 help=_("Names of IPMI sensors that should be ignored during inventory "
74 "and when summarizing."
75 "The pattern specified here must match exactly the beginning of "
76 "the actual sensor name (case sensitive)."),
77 orientation
="horizontal")),
78 ("ignored_sensorstates",
80 title
=_("Ignore the following IPMI sensor states"),
82 "IPMI sensors with these states that should be ignored during inventory "
83 "and when summarizing."
84 "The pattern specified here must match exactly the beginning of "
85 "the actual sensor name (case sensitive)."),
86 orientation
="horizontal",
89 forth
=transform_ipmi_inventory_rules
),
92 register_check_parameters(
93 RulespecGroupCheckParametersEnvironment
,
100 Tuple(elements
=[TextAscii(), MonitoringState()]),
101 title
=_("Set states of IPMI sensor status texts"),
102 help=_("The pattern specified here must match exactly the beginning of "
103 "the sensor state (case sensitive)."),
104 orientation
="horizontal",
108 title
=_("Ignore the following IPMI sensors"),
109 help=_("Names of IPMI sensors that should be ignored during discovery "
110 "and when summarizing."
111 "The pattern specified here must match exactly the beginning of "
112 "the actual sensor name (case sensitive)."),
113 orientation
="horizontal")),
114 ("ignored_sensorstates",
116 title
=_("Ignore the following IPMI sensor states"),
117 help=_("IPMI sensors with these states that should be ignored during discovery "
118 "and when summarizing."
119 "The pattern specified here must match exactly the beginning of "
120 "the actual sensor name (case sensitive)."),
121 orientation
="horizontal",
122 default_value
=["nr", "ns"])),
123 ("numerical_sensor_levels",
128 title
=_("Sensor name (only summary)"),
130 "In summary mode you have to state the sensor name. "
131 "In single mode the sensor name comes from service description.")),
132 Dictionary(elements
=[
134 Tuple(title
=_("Lower levels"), elements
=[Float(), Float()])),
136 Tuple(title
=_("Upper levels"), elements
=[Float(), Float()])),
139 title
=_("Set lower and upper levels for numerical sensors"))),
141 ignored_keys
=["ignored_sensors", "ignored_sensor_states"],
143 TextAscii(title
=_("The sensor name")),