Cleanup config.nodes_of
[check_mk.git] / checks / cmctc
blob8bb0d1541c460d541ea4fbc6298298b51d95a934
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
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 # Table columns:
28 # 0: index
29 # 1: sensor type (10 = temperature)
30 # 2: sensor state (4 = ok)
31 # 3: current value (temperature)
32 # 4: critical level
33 # 5: warn low level
34 # 6: warn level
35 # 7: description
38 def inventory_cmctc_temp(info):
39 for line in info:
40 if saveint(line[1]) == 10:
41 yield line[0], None
44 def check_cmctc_temp(item, params, info):
45 for line in info: # , value1, value2 in info:
46 if line[0] != item:
47 continue
49 status, current, crit, low, warn = map(int, line[2:7])
51 return check_temperature(
52 current,
53 params,
54 "cmctc_temp_%s" % item,
55 dev_levels=(warn, crit),
56 dev_levels_lower=(low, float("-inf")), # no lower critical level specified
57 dev_status=cmctc_translate_status(status),
58 dev_status_name="Unit: %s" % cmctc_translate_status_text(status))
61 check_info['cmctc.temp'] = {
62 "check_function": check_cmctc_temp,
63 "inventory_function": inventory_cmctc_temp,
64 "has_perfdata": True,
65 "service_description": "Temperature %s",
66 "group": "temperature",
67 "includes": ["temperature.include", "cmctc.include"],
68 "snmp_scan_function": cmctc_snmp_scan_function,
69 "snmp_info": (
70 # Base to all IO units
71 ".1.3.6.1.4.1.2606.4.2",
72 # Each of the up to 4 units has its own subtree
73 ["3", "4", "5", "6"],
75 # sensors index (1-4)
76 "5.2.1.1",
77 # sensor type (10 = temperature)
78 "5.2.1.2",
79 # unit status: notAvail(1), lost(2), changed(3), ok(4), off(5), on(6), warning(7), tooLow(8), tooHigh(9)
80 "5.2.1.4",
81 # current value
82 "5.2.1.5",
83 # high value (used for critical state)
84 "5.2.1.6",
85 # low value (used for warning, if temp falls below this value)
86 "5.2.1.7",
87 # warn value (used for warning state)
88 "5.2.1.8",
89 # description (configured by user via admin interface)
90 "7.2.1.2",
91 ]),