Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / raritan_pdu_inlet_summary
blob310a278c27be57c559fa0478db04f0858f3d7b9d
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.
28 def parse_raritan_pdu_inlet_summary(info):
29 summary = {}
30 for sensor_type, decimal_digits, availability, sensor_state, value in info:
31 if availability == '1':
32 if sensor_type in raritan_map_type: # handled sensor types
33 key, _key_info = raritan_map_type[sensor_type] # get key for elphase.include
34 value = float(value) / 10**int(decimal_digits)
35 state, state_info = raritan_map_state[sensor_state]
37 if state > 0:
38 summary[key] = (value, (state, state_info))
39 else:
40 summary[key] = (value, None)
42 return {"Summary": summary}
45 check_info['raritan_pdu_inlet_summary'] = {
46 "parse_function": parse_raritan_pdu_inlet_summary,
47 "inventory_function": inventory_elphase,
48 "check_function": check_elphase,
49 "service_description": "Input %s",
50 "has_perfdata": True,
51 "group": "el_inphase",
52 "snmp_info": (
53 ".1.3.6.1.4.1.13742.6",
55 OID_END,
56 "3.3.4.1.7.1.1", # inletDecimalDigits value
57 "5.2.3.1.2.1.1", # inlet sensor availability
58 "5.2.3.1.3.1.1", # inlet sensor state
59 "5.2.3.1.4.1.1", # inlet sensor value
60 ]),
61 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.13742.6",
62 "includes": ['raritan.include', 'elphase.include']