checkmk-plugins/check_mk-clever-pdu/cmk1.6/local/share/check_mk/web/plugins/wato/clever_pdu.py

84 lines
3.2 KiB
Python
Executable File

#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
from cmk.gui.i18n import _
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersEnvironment,
)
from cmk.gui.valuespec import Dictionary, Integer, TextAscii, Tuple
def _parameter_valuespec_clever_pdu():
return Dictionary(
elements=[
(
"voltage",
Tuple(
title=_("Voltage on Line"),
elements=[
Integer(title=_("warning at"), unit=_("V")),
Integer(title=_("critical at"), unit=_("V")),
],
),
),
(
"current",
Tuple(
title=_("Current on Power Channel"),
elements=[
Integer(title=_("warning if below"), unit=_("A")),
Integer(title=_("critical if below"), unit=_("A")),
],
),
),
(
"energy",
Tuple(
title=_("Active Energy of Line"),
elements=[
Integer(title=_("warning at"), unit=_("W")),
Integer(title=_("critical at"), unit=_("W")),
],
),
),
],
)
rulespec_registry.register(
CheckParameterRulespecWithItem(
check_group_name="clever_pdu",
group=RulespecGroupCheckParametersEnvironment,
item_spec=lambda: TextAscii(title=_("Line"),),
match_type="dict",
parameter_valuespec=_parameter_valuespec_clever_pdu,
title=lambda: _("Levels for Clever AC PDU Devices"),
)
)