Cleanup config.nodes_of
[check_mk.git] / checks / cmctc_psm_m
blobb01bf5c89d3d45c4f11ac1de241d09071be0b754
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 (30 = Power PSM,)
30 # 2: sensor state (4 = ok)
31 # 3: current value (Ampere)
32 # 4: critical level
33 # 5: warn low level
34 # 6: warn level
35 # 7: description
37 cmctc_pcm_m_sensor_types = {
38 72: "kW",
39 73: "kW",
40 74: "hz",
41 75: "V",
42 77: "A",
43 79: "kW",
44 80: "kW",
46 check_config_variables.append("cmctc_pcm_m_sensor_types")
49 def inventory_cmctc_psm_m(info):
50 return [(line[7] + " " + line[0], None)
51 for line in info
52 if saveint(line[1]) in cmctc_pcm_m_sensor_types.keys()]
55 def check_cmctc_psm_m(item, no_params, info):
56 for line in info:
57 if line[7] + " " + line[0] != item:
58 continue
59 sensor_type = saveint(line[1])
60 unit = cmctc_pcm_m_sensor_types[sensor_type]
61 current_val = saveint(line[3]) / 10
62 output = "%s at %d%s " % (line[7], current_val, unit)
63 perf = [(unit, current_val, "", "", "", "")]
64 if int(line[2]) == 4:
65 return (0, output, perf)
66 return (2, output, perf)
68 return (3, "Item no found in SNMP tree")
71 check_info["cmctc_psm_m"] = {
72 'check_function': check_cmctc_psm_m,
73 'inventory_function': inventory_cmctc_psm_m,
74 'service_description': 'CMC %s',
75 'has_perfdata': True,
76 'snmp_info': (
77 # Base to all IO units
78 ".1.3.6.1.4.1.2606.4.2",
79 # Each of the up to 4 units has its own subtree
80 ["3", "4", "5", "6"],
82 # sensors index (1-4)
83 "5.2.1.1",
84 # sensor type (10 = temperature)
85 "5.2.1.2",
86 # unit status: notAvail(1), lost(2), changed(3), ok(4), off(5), on(6), warning(7), tooLow(8), tooHigh(9)
87 "5.2.1.4",
88 # current value
89 "5.2.1.5",
90 # high value (used for critical state)
91 "5.2.1.6",
92 # low value (used for warning, if temp falls below this value)
93 "5.2.1.7",
94 # warn value (used for warning state)
95 "5.2.1.8",
96 #Port Desct
97 "5.2.1.3",
98 ]),
99 'snmp_scan_function': cmctc_snmp_scan_function,
100 "includes": ["cmctc.include"],