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.
28 def inventory_cmciii_lcp_waterflow(info
):
33 def check_cmciii_lcp_waterflow(item
, params
, info
):
35 # We have a list of values where no item has a fixed index. We
36 # try to detect the starting index for the needed values now.
38 index
= info
[0].index('Waterflow')
39 name
, flow
, maxflow
, minflow
, status
= info
[0][index
:index
+ 5]
41 return 3, 'Waterflow information not found'
43 unit
= flow
.split(" ", 1)[1]
44 flow
= float(flow
.split(" ", 1)[0])
45 minflow
= float(minflow
.split(" ", 1)[0])
46 maxflow
= float(maxflow
.split(" ", 1)[0])
53 elif flow
< minflow
or flow
> maxflow
:
57 info_text
= "%s Status: %s Flow: %.1f%s, MinFlow: %.1f, MaxFLow: %.1f" \
58 % (name
, status
, flow
, sym
, minflow
, maxflow
)
60 perfdata
= [("flow", str(flow
) + unit
, str(minflow
) + ":" + str(maxflow
), 0, 0)]
62 return state
, info_text
, perfdata
64 return (3, "no SNMP data found")
67 check_info
['cmciii_lcp_waterflow'] = {
68 "check_function": check_cmciii_lcp_waterflow
,
69 "inventory_function": inventory_cmciii_lcp_waterflow
,
71 "service_description": "LCP Fanunit WATER FLOW",
72 "snmp_scan_function": lambda oid
: oid(".1.3.6.1.2.1.1.1.0").startswith("Rittal LCP"),
73 "snmp_info": ('.1.3.6.1.4.1.2606.7.4.2.2.1.10.2', range(74, 87)),