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 # Note: The CMCIII checks for Water IN/OUT and similar stuff are
28 # deep and fundamentally broken (such as the implementation of
29 # Rittal). Need to rewrite an make *one* check with subchecks.
36 # ['Air-Temperatures'],
56 def parse_cmciii_lcp_water(info
):
59 if line
[0].endswith(" Unit"):
60 unit_name
= line
[0].split(" ")[0]
62 units
[unit_name
] = unit_lines
64 unit_lines
.append(line
[0])
70 def inventory_cmciii_lcp_water(parsed
):
74 def check_cmciii_lcp_water(item
, params
, parsed
):
75 # New check: This sensor is handled by cmciii.temp
76 def parse_status(status_name
):
77 if status_name
.lower() == "ok":
79 elif status_name
.lower() == "warning":
83 unit_status_name
= parsed
[2]
84 yield parse_status(unit_status_name
), "Unit: %s" % unit_status_name
91 # ['18.2 \xb0C', '50.0 \xb0C', '40.0 \xb0C', '13.0 \xb0C', '10.0 \xb0C', '3 %', 'OK']
93 temperatures
= [float(x
.split()[0]) for x
in lines
[0:5]]
94 temp
= temperatures
[0]
95 limits
= temperatures
[1:]
96 status_name
= lines
[-1]
98 status
, info_text
, perf_data
= check_temperature(
101 "cmciii_lcp_water_" + item
,
102 dev_levels
=(limits
[1], limits
[0]),
103 dev_levels_lower
=(limits
[2], limits
[3]),
104 dev_status
=parse_status(status_name
),
105 dev_status_name
=status_name
)
107 yield status
, "Temperature: " + info_text
, perf_data
110 check_info
['cmciii_lcp_water'] = {
111 "parse_function" : parse_cmciii_lcp_water
,
112 "check_function" : check_cmciii_lcp_water
,
113 "inventory_function" : inventory_cmciii_lcp_water
,
114 "has_perfdata" : True,
115 "service_description" : "Temperature Water LCP %s",
116 "snmp_scan_function" : lambda oid
: oid(".1.3.6.1.2.1.1.1.0").startswith("Rittal LCP") and \
117 oid(".1.3.6.1.4.1.2606.7.4.2.2.1.3.2.6").startswith("Air.Temperature.DescName"),
118 "snmp_info" : ( '.1.3.6.1.4.1.2606.7.4.2.2.1.10', [2] ),
119 "group" : "temperature",
120 "includes" : [ "temperature.include" ]