Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / alcatel_power
blob1563cfacc319a389036c0e07b29633a349a9b571
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_alcatel_power(info):
29 known_types = ['0x35000001', '0x45000002', '0x45000004', '0x45000008', '0x45000009']
31 def is_power_device(device_type, power_type):
32 return (power_type in ('1', '2') or
33 # for old devices not providing power_type
34 power_type == '' and device_type in known_types)
36 return {
37 item: status
38 for (item, status, device_type, power_type) in info
39 if is_power_device(device_type, power_type)
43 @get_parsed_item_data
44 def check_alcatel_power(_no_item, _no_params, status):
45 if status == '1':
46 return 0, "Supply status OK"
47 return 2, "Supply in error condition (%s)" % status
50 check_info["alcatel_power"] = {
51 "parse_function": parse_alcatel_power,
52 "check_function": check_alcatel_power,
53 "inventory_function": discover(),
54 "service_description": "Power Supply %s",
55 "snmp_scan_function": alcatel_networking_products_scan_function,
56 "snmp_info": (
57 ".1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1", # MIB object "chasEntPhysicalEntry"
59 OID_END,
60 2, # MIB object "chasEntPhysOperStatus":
61 # up(1), down(2), testing(3), unknown(4),
62 # secondary(5), notPresent(6), unpowered(7), master(9)
63 5, # MIB object "chasEntPhysModuleType":
64 # Device Type (0x35000001 == Power Supply)
65 36, # MIB object "chasEntPhysPowerType":
66 # 0 no power supply, 1 ac, 2 dc (not available on old devices)
67 ]),
68 "includes": ["alcatel.include"],