GUI CSS: Deployed view styles for layouts (CMK-1171)
[check_mk.git] / checks / pandacom_psu
blob81db2b2770c2a781a45236dac6233eabb57b5a8b
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2015 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 # .1.3.6.1.4.1.3652.3.2.1.1.0 M9-2 --> SPEEDCARRIER-MIB::nmCarrierName.0
28 # .1.3.6.1.4.1.3652.3.2.1.2.0 4 --> SPEEDCARRIER-MIB::nmCarrierType.0
29 # .1.3.6.1.4.1.3652.3.2.1.3.0 3 --> SPEEDCARRIER-MIB::nmPSU1Status.0
30 # .1.3.6.1.4.1.3652.3.2.1.4.0 3 --> SPEEDCARRIER-MIB::nmPSU2Status.0
31 # .1.3.6.1.4.1.3652.3.2.1.5.0 3 --> SPEEDCARRIER-MIB::nmFanState.0
32 # .1.3.6.1.4.1.3652.3.2.1.6.0 8 --> SPEEDCARRIER-MIB::nmCarrierPSU1Type.0
33 # .1.3.6.1.4.1.3652.3.2.1.7.0 8 --> SPEEDCARRIER-MIB::nmCarrierPSU2Type.0
34 # .1.3.6.1.4.1.3652.3.2.1.8.0 --> SPEEDCARRIER-MIB::nmCarrierPSU1Text.0
35 # .1.3.6.1.4.1.3652.3.2.1.9.0 --> SPEEDCARRIER-MIB::nmCarrierPSU2Text.0
36 # .1.3.6.1.4.1.3652.3.2.1.10.0 --> SPEEDCARRIER-MIB::nmCarrierPSU3Text.0
37 # .1.3.6.1.4.1.3652.3.2.1.11.0 0 --> SPEEDCARRIER-MIB::nmCarrierPSU3Type.0
38 # .1.3.6.1.4.1.3652.3.2.1.12.0 0 --> SPEEDCARRIER-MIB::nmPSU3Status.0
41 def parse_pandacom_psu(info):
42 map_psu_type = {
43 "0": "type not configured",
44 "1": "230 V AC 75 W",
45 "2": "230 V AC 160 W",
46 "3": "48 V DC 75 W",
47 "4": "48 V DC 150 W",
48 "5": "48 V DC 60 W",
49 "6": "230 V AC 60 W",
50 "7": "48 V DC 250 W",
51 "8": "230 V AC 250 W",
52 "255": "type not available",
54 map_psu_state = {
55 "0": (3, "not installed"),
56 "1": (2, "fail"),
57 "2": (1, "temperature warning"),
58 "3": (0, "pass"),
59 "255": (3, "not available"),
61 parsed = {}
62 for psu_nr, type_index, state_index in [
63 ("1", 5, 2),
64 ("2", 6, 3),
65 ("3", 10, 11),
67 if info[state_index][0] not in ["0", "255"]:
68 parsed[psu_nr] = {
69 "type": map_psu_type[info[type_index][0]],
70 "state": map_psu_state[info[state_index][0]],
73 return parsed
76 def inventory_pandacom_psu(parsed):
77 return [(psu_nr, None) for psu_nr in parsed]
80 def check_pandacom_psu(item, _no_params, parsed):
81 if item in parsed:
82 state, state_readable = parsed[item]["state"]
83 return state, "[%s] Operational status: %s" % (parsed[item]["type"], state_readable)
86 check_info['pandacom_psu'] = {
87 'parse_function': parse_pandacom_psu,
88 'inventory_function': inventory_pandacom_psu,
89 'check_function': check_pandacom_psu,
90 'service_description': 'Power Supply %s',
91 'snmp_info': (".1.3.6.1.4.1.3652.3.2.1", [""]),
92 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.3652.3",