added checkmk checks for clever_pdu with firmware 1.2.0 and 1.3.0
This commit is contained in:
parent
d7ba6d93f4
commit
0aa461839b
20
check_mk-clever-pdu/cmk1.6/README
Normal file
20
check_mk-clever-pdu/cmk1.6/README
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{'author': u'George Pochiscan',
|
||||||
|
'description': u'',
|
||||||
|
'download_url': '',
|
||||||
|
'files': {'checkman': ['clever_pdu',
|
||||||
|
'clever_pdu_humidity',
|
||||||
|
'clever_pdu_temp'],
|
||||||
|
'checks': ['clever_pdu_120',
|
||||||
|
'clever_pdu_130',
|
||||||
|
'clever_pdu_humidity_120',
|
||||||
|
'clever_pdu_humidity_130',
|
||||||
|
'clever_pdu_temp_120',
|
||||||
|
'clever_pdu_temp_130'],
|
||||||
|
'web': ['plugins/wato/clever_pdu.py']},
|
||||||
|
'name': 'clever_pdu_1-6',
|
||||||
|
'num_files': 10,
|
||||||
|
'title': u'Clever PDU checks for Checkmk 1.6',
|
||||||
|
'version': '1.1',
|
||||||
|
'version.min_required': '1.6.0p20',
|
||||||
|
'version.packaged': '1.6.0p29',
|
||||||
|
'version.usable_until': '2.0.0p1'}
|
BIN
check_mk-clever-pdu/cmk1.6/clever_pdu_1-6-1.1.mkp
Normal file
BIN
check_mk-clever-pdu/cmk1.6/clever_pdu_1-6-1.1.mkp
Normal file
Binary file not shown.
@ -0,0 +1,13 @@
|
|||||||
|
title: Clever PDU Units: Power and Voltage
|
||||||
|
agents: snmp
|
||||||
|
catalog: hw/power/clever
|
||||||
|
license: GPLv2
|
||||||
|
distribution: check_mk
|
||||||
|
description:
|
||||||
|
Monitors Power, Voltage and energy on Clever PDU Units.
|
||||||
|
|
||||||
|
item:
|
||||||
|
ID of the Line.
|
||||||
|
|
||||||
|
discovery:
|
||||||
|
One service is created for each Line.
|
@ -0,0 +1,13 @@
|
|||||||
|
title: Clever PDU Units: Master Humidity
|
||||||
|
agents: snmp
|
||||||
|
catalog: hw/power/clever
|
||||||
|
license: GPLv2
|
||||||
|
distribution: check_mk
|
||||||
|
description:
|
||||||
|
Monitors Master Humidity on Clever PDU Units.
|
||||||
|
|
||||||
|
item:
|
||||||
|
Master Humidity.
|
||||||
|
|
||||||
|
discovery:
|
||||||
|
One service is created.
|
@ -0,0 +1,13 @@
|
|||||||
|
title: Clever PDU Units: Master Temperature
|
||||||
|
agents: snmp
|
||||||
|
catalog: hw/power/clever
|
||||||
|
license: GPLv2
|
||||||
|
distribution: check_mk
|
||||||
|
description:
|
||||||
|
Monitors Master Temperature on Clever PDU Units.
|
||||||
|
|
||||||
|
item:
|
||||||
|
Master Temperature.
|
||||||
|
|
||||||
|
discovery:
|
||||||
|
One service is created.
|
@ -0,0 +1,129 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
# | ____ _ _ __ __ _ __ |
|
||||||
|
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||||
|
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||||
|
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||||
|
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||||
|
# | |
|
||||||
|
# | Copyright Mathias Kettner 2016 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.
|
||||||
|
|
||||||
|
factory_settings["clever_pdu_default_levels"] ={
|
||||||
|
"voltage": (240, 250),
|
||||||
|
"current": (32, 33),
|
||||||
|
"energy": (35000, 36000),
|
||||||
|
}
|
||||||
|
|
||||||
|
lines = {"Line 1", "Line 2", "Line 3"}
|
||||||
|
_UNIT_MAP = {
|
||||||
|
"voltage": "V" ,
|
||||||
|
"current": "A" ,
|
||||||
|
"energy": "W",
|
||||||
|
}
|
||||||
|
|
||||||
|
def parse_clever_pdu_120(info):
|
||||||
|
data=info[0]
|
||||||
|
parsed = {}
|
||||||
|
parsed = {
|
||||||
|
"Line 1" : {
|
||||||
|
"voltage": float(data[0]),
|
||||||
|
"current": float(data[3])/10,
|
||||||
|
"energy": float(data[6]),
|
||||||
|
},
|
||||||
|
"Line 2" : {
|
||||||
|
"voltage": float(data[1]),
|
||||||
|
"current": float(data[4])/10,
|
||||||
|
"energy": float(data[7]),
|
||||||
|
},
|
||||||
|
"Line 3" : {
|
||||||
|
"voltage": float(data[2]),
|
||||||
|
"current": float(data[5])/10,
|
||||||
|
"energy": float(data[8]),
|
||||||
|
},
|
||||||
|
"Total Energy" : {
|
||||||
|
"energy" : float((float(data[0])*float(data[3])/10)) + float((float(data[1])*float(data[4])/10)) + float((float(data[2])*float(data[5])/10)),
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
def inventory_clever_pdu_120(parsed):
|
||||||
|
for line in parsed:
|
||||||
|
yield line, {}
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_120(item, params, parsed):
|
||||||
|
if "Total" not in item:
|
||||||
|
for param in params:
|
||||||
|
levels_lower = levels_upper = None
|
||||||
|
warn, crit = params.get(param)
|
||||||
|
if warn > crit:
|
||||||
|
levels_lower = warn, crit
|
||||||
|
else:
|
||||||
|
levels_upper = warn, crit
|
||||||
|
|
||||||
|
yield check_levels(
|
||||||
|
parsed.get(item).get(param),
|
||||||
|
param,
|
||||||
|
(warn, crit),
|
||||||
|
unit = _UNIT_MAP.get(param),
|
||||||
|
infoname = param
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
for param in params:
|
||||||
|
if "energy" in param:
|
||||||
|
levels_lower = levels_upper = None
|
||||||
|
warn, crit = params.get(param)
|
||||||
|
if warn > crit:
|
||||||
|
levels_lower = warn, crit
|
||||||
|
else:
|
||||||
|
levels_upper = warn, crit
|
||||||
|
yield check_levels(
|
||||||
|
parsed.get(item).get(param),
|
||||||
|
param,
|
||||||
|
(warn, crit),
|
||||||
|
unit = _UNIT_MAP.get(param),
|
||||||
|
infoname = param
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
check_info['clever_pdu_120'] = {
|
||||||
|
'parse_function' : parse_clever_pdu_120,
|
||||||
|
'inventory_function' : inventory_clever_pdu_120,
|
||||||
|
'check_function' : check_clever_pdu_120,
|
||||||
|
'service_description' : '%s',
|
||||||
|
'has_perfdata' : True,
|
||||||
|
'group' : "clever_pdu",
|
||||||
|
'snmp_info' : ('.1.3.6.1.4.1.30966.10.3.2',
|
||||||
|
[
|
||||||
|
'1',
|
||||||
|
'2',
|
||||||
|
'3',
|
||||||
|
'4',
|
||||||
|
'5',
|
||||||
|
'6',
|
||||||
|
'7',
|
||||||
|
'8',
|
||||||
|
'9',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.30966") and oid(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
'default_levels_variable' : 'clever_pdu_default_levels',
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
# | ____ _ _ __ __ _ __ |
|
||||||
|
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||||
|
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||||
|
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||||
|
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||||
|
# | |
|
||||||
|
# | Copyright Mathias Kettner 2016 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.
|
||||||
|
|
||||||
|
factory_settings["clever_pdu_default_levels"] ={
|
||||||
|
"voltage": (240, 250),
|
||||||
|
"current": (32, 33),
|
||||||
|
"energy": (35000, 36000),
|
||||||
|
}
|
||||||
|
|
||||||
|
lines = {"Line 1", "Line 2", "Line 3"}
|
||||||
|
_UNIT_MAP = {
|
||||||
|
"voltage": "V" ,
|
||||||
|
"current": "A" ,
|
||||||
|
"energy": "W",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def parse_clever_pdu(info):
|
||||||
|
data=info[0]
|
||||||
|
parsed = {}
|
||||||
|
parsed = {
|
||||||
|
"Line 1" : {
|
||||||
|
"voltage": float(data[0]),
|
||||||
|
"current": float(float(data[3])/10),
|
||||||
|
"energy" : float((float(data[0])*float(data[3])/10)),
|
||||||
|
},
|
||||||
|
"Line 2" : {
|
||||||
|
"voltage": float(data[1]),
|
||||||
|
"current": float(float(data[4])/10),
|
||||||
|
"energy" : float((float(data[1])*float(data[4])/10)),
|
||||||
|
},
|
||||||
|
"Line 3" : {
|
||||||
|
"voltage": float(data[2]),
|
||||||
|
"current": float(float(data[5])/10),
|
||||||
|
"energy" : float((float(data[2])*float(data[5])/10)),
|
||||||
|
},
|
||||||
|
"Total Energy" : {
|
||||||
|
"energy" : float((float(data[0])*float(data[3])/10)) + float((float(data[1])*float(data[4])/10)) + float((float(data[2])*float(data[5])/10)),
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
def inventory_clever_pdu(parsed):
|
||||||
|
for line in parsed:
|
||||||
|
yield line, {}
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu(item, params, parsed):
|
||||||
|
if "Total" not in item:
|
||||||
|
for param in params:
|
||||||
|
levels_lower = levels_upper = None
|
||||||
|
warn, crit = params.get(param)
|
||||||
|
if warn > crit:
|
||||||
|
levels_lower = warn, crit
|
||||||
|
else:
|
||||||
|
levels_upper = warn, crit
|
||||||
|
|
||||||
|
yield check_levels(
|
||||||
|
parsed.get(item).get(param),
|
||||||
|
param,
|
||||||
|
(warn, crit),
|
||||||
|
unit = _UNIT_MAP.get(param),
|
||||||
|
infoname = param
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
for param in params:
|
||||||
|
if "energy" in param:
|
||||||
|
levels_lower = levels_upper = None
|
||||||
|
warn, crit = params.get(param)
|
||||||
|
if warn > crit:
|
||||||
|
levels_lower = warn, crit
|
||||||
|
else:
|
||||||
|
levels_upper = warn, crit
|
||||||
|
yield check_levels(
|
||||||
|
parsed.get(item).get(param),
|
||||||
|
param,
|
||||||
|
(warn, crit),
|
||||||
|
unit = _UNIT_MAP.get(param),
|
||||||
|
infoname = param
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
check_info['clever_pdu'] = {
|
||||||
|
'parse_function' : parse_clever_pdu,
|
||||||
|
'inventory_function' : inventory_clever_pdu,
|
||||||
|
'check_function' : check_clever_pdu,
|
||||||
|
'service_description' : '%s',
|
||||||
|
'has_perfdata' : True,
|
||||||
|
'group' : "clever_pdu",
|
||||||
|
'snmp_info' : ('.1.3.6.1.4.1.30966.10.3.2',
|
||||||
|
[
|
||||||
|
'1',
|
||||||
|
'2',
|
||||||
|
'3',
|
||||||
|
'4',
|
||||||
|
'5',
|
||||||
|
'6',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.30966") and not oid(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
'default_levels_variable' : 'clever_pdu_default_levels',
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
# | ____ _ _ __ __ _ __ |
|
||||||
|
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||||
|
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||||
|
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||||
|
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||||
|
# | |
|
||||||
|
# | Copyright Mathias Kettner 2016 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.
|
||||||
|
|
||||||
|
factory_settings["clever_pdu_humidity_default_levels"] = {
|
||||||
|
"levels": (60, 70),
|
||||||
|
}
|
||||||
|
|
||||||
|
def inventory_clever_pdu_humidity_120(info):
|
||||||
|
yield "Master humidity", {}
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_humidity_120(item, params, info):
|
||||||
|
return check_humidity(float(info[0][0]), params)
|
||||||
|
|
||||||
|
|
||||||
|
check_info['clever_pdu_humidity_120'] = {
|
||||||
|
'inventory_function' : inventory_clever_pdu_humidity_120,
|
||||||
|
'check_function' : check_clever_pdu_humidity_120,
|
||||||
|
'service_description' : '%s',
|
||||||
|
'has_perfdata' : True,
|
||||||
|
'snmp_info' : ('.1.3.6.1.4.1.30966.10.3.2.14', ['0']),
|
||||||
|
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.30966") and oid(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
'group' : 'humidity',
|
||||||
|
'default_levels_variable' : 'clever_pdu_humidity_default_levels',
|
||||||
|
'includes' : ['humidity.include'],
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
# | ____ _ _ __ __ _ __ |
|
||||||
|
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||||
|
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||||
|
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||||
|
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||||
|
# | |
|
||||||
|
# | Copyright Mathias Kettner 2016 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.
|
||||||
|
|
||||||
|
factory_settings["clever_pdu_humidity_default_levels"] = {
|
||||||
|
"levels": (60, 70),
|
||||||
|
}
|
||||||
|
|
||||||
|
def inventory_clever_pdu_humidity(info):
|
||||||
|
yield "Master humidity", {}
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_humidity(item, params, info):
|
||||||
|
return check_humidity(float(info[0][0]), params)
|
||||||
|
|
||||||
|
|
||||||
|
check_info['clever_pdu_humidity'] = {
|
||||||
|
'inventory_function' : inventory_clever_pdu_humidity,
|
||||||
|
'check_function' : check_clever_pdu_humidity,
|
||||||
|
'service_description' : '%s',
|
||||||
|
'has_perfdata' : True,
|
||||||
|
'snmp_info' : ('.1.3.6.1.4.1.30966.10.3.2.11', ['0']),
|
||||||
|
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.30966") and not oid(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
'group' : 'humidity',
|
||||||
|
'default_levels_variable' : 'clever_pdu_humidity_default_levels',
|
||||||
|
'includes' : ['humidity.include'],
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
# | ____ _ _ __ __ _ __ |
|
||||||
|
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||||
|
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||||
|
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||||
|
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||||
|
# | |
|
||||||
|
# | Copyright Mathias Kettner 2016 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.
|
||||||
|
|
||||||
|
factory_settings["clever_pdu_temp_default_levels"] = {
|
||||||
|
"levels": (60, 70),
|
||||||
|
}
|
||||||
|
|
||||||
|
def inventory_clever_pdu_temp_120(info):
|
||||||
|
yield "Master Temperature", {}
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_temp_120(item, params, info):
|
||||||
|
return check_temperature(float(info[0][0]), params, "Master Temperature %s" %item)
|
||||||
|
|
||||||
|
|
||||||
|
check_info['clever_pdu_temp_120'] = {
|
||||||
|
'inventory_function' : inventory_clever_pdu_temp_120,
|
||||||
|
'check_function' : check_clever_pdu_temp_120,
|
||||||
|
'service_description' : '%s',
|
||||||
|
'has_perfdata' : True,
|
||||||
|
'snmp_info' : ('.1.3.6.1.4.1.30966.10.3.2.13', ['0']),
|
||||||
|
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.30966") and oid(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
'group' : 'temperature',
|
||||||
|
'default_levels_variable' : 'clever_pdu_temp_default_levels',
|
||||||
|
'includes' : ['temperature.include'],
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
# | ____ _ _ __ __ _ __ |
|
||||||
|
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||||
|
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||||
|
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||||
|
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||||
|
# | |
|
||||||
|
# | Copyright Mathias Kettner 2016 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.
|
||||||
|
|
||||||
|
factory_settings["clever_pdu_temp_default_levels"] = {
|
||||||
|
"levels": (60, 70),
|
||||||
|
}
|
||||||
|
|
||||||
|
def inventory_clever_pdu_temp(info):
|
||||||
|
yield "Master Temperature", {}
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_temp(item, params, info):
|
||||||
|
return check_temperature(float(info[0][0]), params, "Master Temperature %s" %item)
|
||||||
|
|
||||||
|
|
||||||
|
check_info['clever_pdu_temp'] = {
|
||||||
|
'inventory_function' : inventory_clever_pdu_temp,
|
||||||
|
'check_function' : check_clever_pdu_temp,
|
||||||
|
'service_description' : '%s',
|
||||||
|
'has_perfdata' : True,
|
||||||
|
'snmp_info' : ('.1.3.6.1.4.1.30966.10.3.2.10', ['0']),
|
||||||
|
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.30966") and not oid(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
'group' : 'temperature',
|
||||||
|
'default_levels_variable' : 'clever_pdu_temp_default_levels',
|
||||||
|
'includes' : ['temperature.include'],
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
#!/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"),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
13
check_mk-clever-pdu/cmk2/checkman/clever_pdu
Normal file
13
check_mk-clever-pdu/cmk2/checkman/clever_pdu
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
title: Clever PDU Units: Power and Voltage
|
||||||
|
agents: snmp
|
||||||
|
catalog: hw/power/clever
|
||||||
|
license: GPLv2
|
||||||
|
distribution: check_mk
|
||||||
|
description:
|
||||||
|
Monitors Power, Voltage and energy on Clever PDU Units.
|
||||||
|
|
||||||
|
item:
|
||||||
|
ID of the Line.
|
||||||
|
|
||||||
|
discovery:
|
||||||
|
One service is created for each Line.
|
13
check_mk-clever-pdu/cmk2/checkman/clever_pdu_humidity
Normal file
13
check_mk-clever-pdu/cmk2/checkman/clever_pdu_humidity
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
title: Clever PDU Units: Master Humidity
|
||||||
|
agents: snmp
|
||||||
|
catalog: hw/power/clever
|
||||||
|
license: GPLv2
|
||||||
|
distribution: check_mk
|
||||||
|
description:
|
||||||
|
Monitors Master Humidity on Clever PDU Units.
|
||||||
|
|
||||||
|
item:
|
||||||
|
Master Humidity.
|
||||||
|
|
||||||
|
discovery:
|
||||||
|
One service is created.
|
13
check_mk-clever-pdu/cmk2/checkman/clever_pdu_temp
Normal file
13
check_mk-clever-pdu/cmk2/checkman/clever_pdu_temp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
title: Clever PDU Units: Master Temperature
|
||||||
|
agents: snmp
|
||||||
|
catalog: hw/power/clever
|
||||||
|
license: GPLv2
|
||||||
|
distribution: check_mk
|
||||||
|
description:
|
||||||
|
Monitors Master Temperature on Clever PDU Units.
|
||||||
|
|
||||||
|
item:
|
||||||
|
Master Temperature.
|
||||||
|
|
||||||
|
discovery:
|
||||||
|
One service is created.
|
BIN
check_mk-clever-pdu/cmk2/clever_pdu_2-1.0.1.mkp
Normal file
BIN
check_mk-clever-pdu/cmk2/clever_pdu_2-1.0.1.mkp
Normal file
Binary file not shown.
20
check_mk-clever-pdu/cmk2/info
Normal file
20
check_mk-clever-pdu/cmk2/info
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{'author': 'George Pochiscan',
|
||||||
|
'description': 'Ported Clever AC PDU from 2.1.0 checkmk version to 2.0.0 '
|
||||||
|
'checkmk version.\n',
|
||||||
|
'download_url': '',
|
||||||
|
'files': {'agent_based': ['utils/humidity.py',
|
||||||
|
'clever_pdu_120.py',
|
||||||
|
'clever_pdu_130.py',
|
||||||
|
'clever_pdu_humidity_120.py',
|
||||||
|
'clever_pdu_humidity_130.py',
|
||||||
|
'clever_pdu_temp_120.py',
|
||||||
|
'clever_pdu_temp_130.py'],
|
||||||
|
'checkman': ['clever_pdu', 'clever_pdu_humidity', 'clever_pdu_temp'],
|
||||||
|
'web': ['plugins/wato/clever_pdu.py']},
|
||||||
|
'name': 'clever_pdu_2',
|
||||||
|
'num_files': 11,
|
||||||
|
'title': 'Clever PDU checks for 2.0 checkmk version',
|
||||||
|
'version': '1.0.1',
|
||||||
|
'version.min_required': '2.0.0p20',
|
||||||
|
'version.packaged': '2.0.0p29',
|
||||||
|
'version.usable_until': '2.1.0p20'}
|
@ -0,0 +1,126 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Iterable, Mapping, Tuple, NamedTuple
|
||||||
|
from .agent_based_api.v1 import check_levels, equals, register, Service, SNMPTree, all_of, exists
|
||||||
|
from .agent_based_api.v1.type_defs import CheckResult, DiscoveryResult, StringTable
|
||||||
|
|
||||||
|
|
||||||
|
def parse_clever_pdu_120(string_table: StringTable):
|
||||||
|
data=string_table[0]
|
||||||
|
parsed = {}
|
||||||
|
parsed = {
|
||||||
|
"Line 1" : {
|
||||||
|
"voltage": float(data[0]),
|
||||||
|
"current": float(data[3])/10,
|
||||||
|
"energy": float(data[6]),
|
||||||
|
},
|
||||||
|
"Line 2" : {
|
||||||
|
"voltage": float(data[1]),
|
||||||
|
"current": float(data[4])/10,
|
||||||
|
"energy": float(data[7]),
|
||||||
|
},
|
||||||
|
"Line 3" : {
|
||||||
|
"voltage": float(data[2]),
|
||||||
|
"current": float(data[5])/10,
|
||||||
|
"energy": float(data[8]),
|
||||||
|
},
|
||||||
|
"Total Energy" : {
|
||||||
|
"energy" : float((float(data[0])*float(data[3])/10)) + float((float(data[1])*float(data[4])/10)) + float((float(data[2])*float(data[5])/10)),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
|
||||||
|
_UNIT_MAP = {
|
||||||
|
"voltage": "V" ,
|
||||||
|
"current": "A" ,
|
||||||
|
"energy": "W",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
register.snmp_section(
|
||||||
|
name="clever_pdu_120",
|
||||||
|
parsed_section_name="clever_pdu_120",
|
||||||
|
parse_function=parse_clever_pdu_120,
|
||||||
|
detect = all_of(
|
||||||
|
equals(
|
||||||
|
".1.3.6.1.2.1.1.2.0",
|
||||||
|
".1.3.6.1.4.1.30966",
|
||||||
|
),
|
||||||
|
exists(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
),
|
||||||
|
fetch=SNMPTree(
|
||||||
|
".1.3.6.1.4.1.30966.10.3.2",
|
||||||
|
[
|
||||||
|
"1", # mVoltageA
|
||||||
|
"2", # mVoltageB
|
||||||
|
"3", # mVoltageC
|
||||||
|
"4", # mCurrentA
|
||||||
|
"5", # mCurrentB
|
||||||
|
"6", # mCurrentC
|
||||||
|
"7", # mEnergyA
|
||||||
|
"8", # mEnergyB
|
||||||
|
"9", # mEnergyC
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def discover_clever_pdu_120(section) -> DiscoveryResult:
|
||||||
|
yield from (Service(item=line_num) for line_num in section)
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_120(item, params, section) -> CheckResult:
|
||||||
|
if "Total" not in item:
|
||||||
|
for param in params:
|
||||||
|
levels_lower = levels_upper = None
|
||||||
|
warn, crit = params.get(param)
|
||||||
|
if warn > crit:
|
||||||
|
levels_lower = warn, crit
|
||||||
|
else:
|
||||||
|
levels_upper = warn, crit
|
||||||
|
|
||||||
|
yield from check_levels(
|
||||||
|
section.get(item)[param],
|
||||||
|
levels_upper = levels_upper,
|
||||||
|
levels_lower = levels_lower,
|
||||||
|
metric_name = param,
|
||||||
|
render_func=lambda v: f"{v:.2f} {_UNIT_MAP[param]}",
|
||||||
|
label = param,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
for param in params:
|
||||||
|
if "energy" in param:
|
||||||
|
levels_lower = levels_upper = None
|
||||||
|
warn, crit = params.get(param)
|
||||||
|
if warn > crit:
|
||||||
|
levels_lower = warn, crit
|
||||||
|
else:
|
||||||
|
levels_upper = warn, crit
|
||||||
|
yield from check_levels(
|
||||||
|
section.get(item)[param],
|
||||||
|
levels_upper = levels_upper,
|
||||||
|
levels_lower = levels_lower,
|
||||||
|
metric_name = param,
|
||||||
|
render_func=lambda v: f"{v:.2f} {_UNIT_MAP[param]}",
|
||||||
|
label = param,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register.check_plugin(
|
||||||
|
name="clever_pdu_120",
|
||||||
|
service_name="%s",
|
||||||
|
discovery_function=discover_clever_pdu_120,
|
||||||
|
check_function=check_clever_pdu_120,
|
||||||
|
check_ruleset_name="clever_pdu",
|
||||||
|
check_default_parameters={
|
||||||
|
"voltage": (220, 210),
|
||||||
|
"current": (32, 33),
|
||||||
|
"energy": (35000, 36000),
|
||||||
|
},
|
||||||
|
)
|
@ -0,0 +1,125 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Iterable, Mapping, Tuple, NamedTuple
|
||||||
|
from .agent_based_api.v1 import check_levels, equals, register, Service, SNMPTree, all_of, not_exists
|
||||||
|
from .agent_based_api.v1.type_defs import CheckResult, DiscoveryResult, StringTable
|
||||||
|
|
||||||
|
|
||||||
|
def parse_clever_pdu_130(string_table: StringTable):
|
||||||
|
data=string_table[0]
|
||||||
|
parsed = {}
|
||||||
|
parsed = {
|
||||||
|
"Line 1" : {
|
||||||
|
"voltage": float(data[0]),
|
||||||
|
"current": float(data[3])/10,
|
||||||
|
"energy" : float((float(data[0])*float(data[3])/10)),
|
||||||
|
},
|
||||||
|
"Line 2" : {
|
||||||
|
"voltage": float(data[1]),
|
||||||
|
"current": float(data[4])/10,
|
||||||
|
"energy" : float((float(data[1])*float(data[4])/10)),
|
||||||
|
},
|
||||||
|
"Line 3" : {
|
||||||
|
"voltage": float(data[2]),
|
||||||
|
"current": float(data[5])/10,
|
||||||
|
"energy" : float((float(data[2])*float(data[5])/10)),
|
||||||
|
},
|
||||||
|
"Total Energy" : {
|
||||||
|
"energy" : float((float(data[0])*float(data[3])/10)) + float((float(data[1])*float(data[4])/10)) + float((float(data[2])*float(data[5])/10)),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
lines = {"Line 1", "Line 2", "Line 3"}
|
||||||
|
|
||||||
|
|
||||||
|
_UNIT_MAP = {
|
||||||
|
"voltage": "V" ,
|
||||||
|
"current": "A" ,
|
||||||
|
"energy": "W",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
register.snmp_section(
|
||||||
|
name="clever_pdu_130",
|
||||||
|
parsed_section_name="clever_pdu_130",
|
||||||
|
parse_function=parse_clever_pdu_130,
|
||||||
|
detect = all_of(
|
||||||
|
equals(
|
||||||
|
".1.3.6.1.2.1.1.2.0",
|
||||||
|
".1.3.6.1.4.1.30966",
|
||||||
|
),
|
||||||
|
not_exists(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
),
|
||||||
|
fetch=SNMPTree(
|
||||||
|
".1.3.6.1.4.1.30966.10.3.2",
|
||||||
|
[
|
||||||
|
"1", # mVoltageA
|
||||||
|
"2", # mVoltageB
|
||||||
|
"3", # mVoltageC
|
||||||
|
"4", # mCurrentA
|
||||||
|
"5", # mCurrentB
|
||||||
|
"6", # mCurrentC
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def discover_clever_pdu_130(section) -> DiscoveryResult:
|
||||||
|
yield from (Service(item=line_num) for line_num in section)
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_130(item, params, section) -> CheckResult:
|
||||||
|
if "Total" not in item:
|
||||||
|
for param in params:
|
||||||
|
levels_lower = levels_upper = None
|
||||||
|
warn, crit = params.get(param)
|
||||||
|
if warn > crit:
|
||||||
|
levels_lower = warn, crit
|
||||||
|
else:
|
||||||
|
levels_upper = warn, crit
|
||||||
|
|
||||||
|
yield from check_levels(
|
||||||
|
section.get(item)[param],
|
||||||
|
levels_upper = levels_upper,
|
||||||
|
levels_lower = levels_lower,
|
||||||
|
metric_name = param,
|
||||||
|
render_func=lambda v: f"{v:.2f} {_UNIT_MAP[param]}",
|
||||||
|
label = param,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
for param in params:
|
||||||
|
if "energy" in param:
|
||||||
|
levels_lower = levels_upper = None
|
||||||
|
warn, crit = params.get(param)
|
||||||
|
if warn > crit:
|
||||||
|
levels_lower = warn, crit
|
||||||
|
else:
|
||||||
|
levels_upper = warn, crit
|
||||||
|
yield from check_levels(
|
||||||
|
section.get(item)[param],
|
||||||
|
levels_upper = levels_upper,
|
||||||
|
levels_lower = levels_lower,
|
||||||
|
metric_name = param,
|
||||||
|
render_func=lambda v: f"{v:.2f} {_UNIT_MAP[param]}",
|
||||||
|
label = param,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register.check_plugin(
|
||||||
|
name="clever_pdu_130",
|
||||||
|
service_name="%s",
|
||||||
|
discovery_function=discover_clever_pdu_130,
|
||||||
|
check_function=check_clever_pdu_130,
|
||||||
|
check_ruleset_name="clever_pdu",
|
||||||
|
check_default_parameters={
|
||||||
|
"voltage": (220, 210),
|
||||||
|
"current": (32, 33),
|
||||||
|
"energy": (35000, 36000),
|
||||||
|
},
|
||||||
|
)
|
@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
from typing import Mapping, Any
|
||||||
|
from .agent_based_api.v1 import check_levels, equals, register, Service, SNMPTree, get_value_store, all_of, exists
|
||||||
|
from .agent_based_api.v1.type_defs import CheckResult, DiscoveryResult, StringTable
|
||||||
|
from .utils.humidity import check_humidity
|
||||||
|
|
||||||
|
CheckParams = Mapping[str, Any]
|
||||||
|
|
||||||
|
def parse_clever_pdu_humidity_120(string_table: StringTable):
|
||||||
|
data=string_table[0]
|
||||||
|
parsed = {}
|
||||||
|
parsed = {
|
||||||
|
"Master Humidity" : int(data[0]),
|
||||||
|
}
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register.snmp_section(
|
||||||
|
name="clever_pdu_humidity_120",
|
||||||
|
parsed_section_name="clever_pdu_humidity_120",
|
||||||
|
parse_function=parse_clever_pdu_humidity_120,
|
||||||
|
detect=all_of(
|
||||||
|
equals(
|
||||||
|
".1.3.6.1.2.1.1.2.0",
|
||||||
|
".1.3.6.1.4.1.30966",
|
||||||
|
),
|
||||||
|
exists(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
),
|
||||||
|
fetch=SNMPTree(
|
||||||
|
".1.3.6.1.4.1.30966.10.3.2",
|
||||||
|
[
|
||||||
|
"14", # mHumidity
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def discover_clever_pdu_humidity_120(section) -> DiscoveryResult:
|
||||||
|
if section.get("Master Humidity") == 0:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
yield from (Service(item=item) for item in section)
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_humidity_120(item, params: CheckParams, section) -> CheckResult:
|
||||||
|
yield from check_humidity(
|
||||||
|
section.get("Master Humidity"),
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
register.check_plugin(
|
||||||
|
name="clever_pdu_humidity_120",
|
||||||
|
service_name="%s",
|
||||||
|
discovery_function=discover_clever_pdu_humidity_120,
|
||||||
|
check_function=check_clever_pdu_humidity_120,
|
||||||
|
check_ruleset_name="humidity",
|
||||||
|
check_default_parameters={},
|
||||||
|
|
||||||
|
)
|
@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
from typing import Mapping, Any
|
||||||
|
from .agent_based_api.v1 import check_levels, equals, register, Service, SNMPTree, get_value_store, all_of, not_exists
|
||||||
|
from .agent_based_api.v1.type_defs import CheckResult, DiscoveryResult, StringTable
|
||||||
|
from .utils.humidity import check_humidity
|
||||||
|
|
||||||
|
CheckParams = Mapping[str, Any]
|
||||||
|
|
||||||
|
def parse_clever_pdu_humidity(string_table: StringTable):
|
||||||
|
data=string_table[0]
|
||||||
|
parsed = {}
|
||||||
|
parsed = {
|
||||||
|
"Master Humidity" : int(data[0]),
|
||||||
|
}
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register.snmp_section(
|
||||||
|
name="clever_pdu_humidity",
|
||||||
|
parsed_section_name="clever_pdu_humidity",
|
||||||
|
parse_function=parse_clever_pdu_humidity,
|
||||||
|
detect=all_of(
|
||||||
|
equals(
|
||||||
|
".1.3.6.1.2.1.1.2.0",
|
||||||
|
".1.3.6.1.4.1.30966",
|
||||||
|
),
|
||||||
|
not_exists(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
),
|
||||||
|
fetch=SNMPTree(
|
||||||
|
".1.3.6.1.4.1.30966.10.3.2",
|
||||||
|
[
|
||||||
|
"11", # mHumidity
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def discover_clever_pdu_humidity(section) -> DiscoveryResult:
|
||||||
|
if section.get("Master Humidity") == 0:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
yield from (Service(item=item) for item in section)
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_humidity(item, params: CheckParams, section) -> CheckResult:
|
||||||
|
yield from check_humidity(
|
||||||
|
section.get("Master Humidity"),
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
register.check_plugin(
|
||||||
|
name="clever_pdu_humidity",
|
||||||
|
service_name="%s",
|
||||||
|
discovery_function=discover_clever_pdu_humidity,
|
||||||
|
check_function=check_clever_pdu_humidity,
|
||||||
|
check_ruleset_name="humidity",
|
||||||
|
check_default_parameters={},
|
||||||
|
|
||||||
|
)
|
@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Iterable, Mapping, Tuple, NamedTuple
|
||||||
|
from .agent_based_api.v1 import check_levels, equals, register, Service, SNMPTree, get_value_store, all_of, exists
|
||||||
|
from .agent_based_api.v1.type_defs import CheckResult, DiscoveryResult, StringTable
|
||||||
|
from .utils.temperature import check_temperature, TempParamDict
|
||||||
|
|
||||||
|
def parse_clever_pdu_temp_120(string_table: StringTable):
|
||||||
|
data=string_table[0]
|
||||||
|
parsed = {}
|
||||||
|
parsed = {
|
||||||
|
"Master Temperature" : int(data[0]),
|
||||||
|
}
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register.snmp_section(
|
||||||
|
name="clever_pdu_temp_120",
|
||||||
|
parsed_section_name="clever_pdu_temp_120",
|
||||||
|
parse_function=parse_clever_pdu_temp_120,
|
||||||
|
detect = all_of(
|
||||||
|
equals(
|
||||||
|
".1.3.6.1.2.1.1.2.0",
|
||||||
|
".1.3.6.1.4.1.30966",
|
||||||
|
),
|
||||||
|
exists(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
),
|
||||||
|
fetch=SNMPTree(
|
||||||
|
".1.3.6.1.4.1.30966.10.3.2",
|
||||||
|
[
|
||||||
|
"13", # mTemperature
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def discover_clever_pdu_temp_120(section) -> DiscoveryResult:
|
||||||
|
if section.get("Master Temperature") == 0:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
yield from (Service(item=item) for item in section)
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_temp_120(item, params: TempParamDict, section) -> CheckResult:
|
||||||
|
if (temperature := section.get(item)) is None:
|
||||||
|
return
|
||||||
|
yield from check_temperature(
|
||||||
|
reading=temperature,
|
||||||
|
params=params,
|
||||||
|
unique_name=item,
|
||||||
|
value_store=get_value_store(),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register.check_plugin(
|
||||||
|
name="clever_pdu_temp_120",
|
||||||
|
service_name="%s",
|
||||||
|
discovery_function=discover_clever_pdu_temp_120,
|
||||||
|
check_function=check_clever_pdu_temp_120,
|
||||||
|
check_ruleset_name="temperature",
|
||||||
|
check_default_parameters={},
|
||||||
|
|
||||||
|
)
|
@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Iterable, Mapping, Tuple, NamedTuple
|
||||||
|
from .agent_based_api.v1 import check_levels, equals, register, Service, SNMPTree, get_value_store, all_of, not_exists
|
||||||
|
from .agent_based_api.v1.type_defs import CheckResult, DiscoveryResult, StringTable
|
||||||
|
from .utils.temperature import check_temperature, TempParamDict
|
||||||
|
|
||||||
|
def parse_clever_pdu_temp(string_table: StringTable):
|
||||||
|
data=string_table[0]
|
||||||
|
parsed = {}
|
||||||
|
parsed = {
|
||||||
|
"Master Temperature" : int(data[0]),
|
||||||
|
}
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register.snmp_section(
|
||||||
|
name="clever_pdu_temp",
|
||||||
|
parsed_section_name="clever_pdu_temp",
|
||||||
|
parse_function=parse_clever_pdu_temp,
|
||||||
|
detect = all_of(
|
||||||
|
equals(
|
||||||
|
".1.3.6.1.2.1.1.2.0",
|
||||||
|
".1.3.6.1.4.1.30966",
|
||||||
|
),
|
||||||
|
not_exists(".1.3.6.1.4.1.30966.10.3.2.70.0"),
|
||||||
|
),
|
||||||
|
fetch=SNMPTree(
|
||||||
|
".1.3.6.1.4.1.30966.10.3.2",
|
||||||
|
[
|
||||||
|
"10", # mTemperature
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def discover_clever_pdu_temp(section) -> DiscoveryResult:
|
||||||
|
if section.get("Master Temperature") == 0:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
yield from (Service(item=item) for item in section)
|
||||||
|
|
||||||
|
|
||||||
|
def check_clever_pdu_temp(item, params: TempParamDict, section) -> CheckResult:
|
||||||
|
if (temperature := section.get(item)) is None:
|
||||||
|
return
|
||||||
|
yield from check_temperature(
|
||||||
|
reading=temperature,
|
||||||
|
params=params,
|
||||||
|
unique_name=item,
|
||||||
|
value_store=get_value_store(),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register.check_plugin(
|
||||||
|
name="clever_pdu_temp",
|
||||||
|
service_name="%s",
|
||||||
|
discovery_function=discover_clever_pdu_temp,
|
||||||
|
check_function=check_clever_pdu_temp,
|
||||||
|
check_ruleset_name="temperature",
|
||||||
|
check_default_parameters={},
|
||||||
|
|
||||||
|
)
|
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
|
||||||
|
from typing import Any, List, Mapping, Optional, Tuple, Union
|
||||||
|
|
||||||
|
from ..agent_based_api.v1 import check_levels, render, type_defs
|
||||||
|
|
||||||
|
CheckParams = Union[
|
||||||
|
None, Mapping[str, Any], Optional[List[float]], Tuple[float, float, float, float]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def check_humidity(humidity: float, params: CheckParams) -> type_defs.CheckResult:
|
||||||
|
levels_upper, levels_lower = None, None
|
||||||
|
if isinstance(params, dict):
|
||||||
|
levels_upper = params.get("levels") or None
|
||||||
|
levels_lower = params.get("levels_lower") or None
|
||||||
|
elif isinstance(params, (list, tuple)):
|
||||||
|
# old params = (crit_low , warn_low, warn, crit)
|
||||||
|
levels_upper = params[2], params[3]
|
||||||
|
levels_lower = params[1], params[0]
|
||||||
|
|
||||||
|
yield from check_levels(
|
||||||
|
humidity,
|
||||||
|
levels_upper=levels_upper,
|
||||||
|
levels_lower=levels_lower,
|
||||||
|
metric_name="humidity",
|
||||||
|
render_func=render.percent,
|
||||||
|
boundaries=(0, 100),
|
||||||
|
)
|
65
check_mk-clever-pdu/cmk2/plugins/wato/clever_pdu.py
Normal file
65
check_mk-clever-pdu/cmk2/plugins/wato/clever_pdu.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
|
||||||
|
from cmk.gui.i18n import _
|
||||||
|
from cmk.gui.plugins.wato.utils import (
|
||||||
|
CheckParameterRulespecWithItem,
|
||||||
|
rulespec_registry,
|
||||||
|
RulespecGroupCheckParametersEnvironment,
|
||||||
|
)
|
||||||
|
from cmk.gui.valuespec import Dictionary, Integer, TextInput, 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: TextInput(
|
||||||
|
title=_("Line"), help=_("The Line Number. Example: 'Line 1'.")
|
||||||
|
),
|
||||||
|
match_type="dict",
|
||||||
|
parameter_valuespec=_parameter_valuespec_clever_pdu,
|
||||||
|
title=lambda: _("Levels for Clever AC PDU Devices"),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user