Cleanup config.nodes_of
[check_mk.git] / checks / intel_true_scale_psus
blob330728305f569325b6cf0ffedc5a7d1ecf6ce3d1
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2016 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.10222.2.1.4.7.1.2.2.1 Power Supply 201 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyDescription.2.1
28 # .1.3.6.1.4.1.10222.2.1.4.7.1.2.3.2 Power Supply 202 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyDescription.3.2
29 # .1.3.6.1.4.1.10222.2.1.4.7.1.2.4.3 Power Supply 203 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyDescription.4.3
30 # .1.3.6.1.4.1.10222.2.1.4.7.1.2.5.4 Power Supply 204 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyDescription.5.4
31 # .1.3.6.1.4.1.10222.2.1.4.7.1.3.2.1 6 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyOperStatus.2.1
32 # .1.3.6.1.4.1.10222.2.1.4.7.1.3.3.2 6 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyOperStatus.3.2
33 # .1.3.6.1.4.1.10222.2.1.4.7.1.3.4.3 6 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyOperStatus.4.3
34 # .1.3.6.1.4.1.10222.2.1.4.7.1.3.5.4 6 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyOperStatus.5.4
35 # .1.3.6.1.4.1.10222.2.1.4.7.1.4.2.1 1 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyInputSource.2.1
36 # .1.3.6.1.4.1.10222.2.1.4.7.1.4.3.2 1 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyInputSource.3.2
37 # .1.3.6.1.4.1.10222.2.1.4.7.1.4.4.3 1 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyInputSource.4.3
38 # .1.3.6.1.4.1.10222.2.1.4.7.1.4.5.4 1 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyInputSource.5.4
39 # .1.3.6.1.4.1.10222.2.1.4.7.1.5.2.1 0 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyVoltage.2.1
40 # .1.3.6.1.4.1.10222.2.1.4.7.1.5.3.2 0 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyVoltage.3.2
41 # .1.3.6.1.4.1.10222.2.1.4.7.1.5.4.3 0 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyVoltage.4.3
42 # .1.3.6.1.4.1.10222.2.1.4.7.1.5.5.4 0 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyVoltage.5.4
43 # .1.3.6.1.4.1.10222.2.1.4.7.1.6.2.1 0 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyOutputPower.2.1
44 # .1.3.6.1.4.1.10222.2.1.4.7.1.6.3.2 0 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyOutputPower.3.2
45 # .1.3.6.1.4.1.10222.2.1.4.7.1.6.4.3 0 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyOutputPower.4.3
46 # .1.3.6.1.4.1.10222.2.1.4.7.1.6.5.4 0 --> ICS-CHASSIS-MIB::icsChassisPowerSupplyOutputPower.5.4
49 def parse_intel_true_scale_psus(info):
50 map_states = {
51 "1": (3, "unknown"),
52 "2": (3, "disabled"),
53 "3": (2, "failed"),
54 "4": (1, "warning"),
55 "5": (0, "standby"),
56 "6": (0, "engaged"),
57 "7": (0, "redundant"),
58 "8": (3, "not present"),
60 map_sources = {
61 "0": "invalid",
62 "1": "ac line",
63 "2": "dc line",
64 "3": "none",
65 "4": "unknown",
68 parsed = {}
69 for descr, operstate, source, voltage_str, power_str in info:
70 name = descr.replace("Power Supply", "").strip()
72 parsed.setdefault(
73 name, {
74 "voltage": float(voltage_str),
75 "power": float(power_str),
76 "state": map_states[operstate],
77 "source": map_sources[source]
80 return parsed
83 def inventory_intel_true_scale_psus(parsed):
84 for psu in parsed:
85 if parsed[psu]["state"][-1] not in ["not present", "disabled"]:
86 yield psu, {}
89 def check_intel_true_scale_psus(item, params, parsed):
90 if item in parsed:
91 state, state_readable = parsed[item]["state"]
92 yield state, "Operational status: %s, Source: %s" % \
93 (state_readable, parsed[item]["source"])
95 for res in check_elphase(item, params, parsed):
96 yield res
99 check_info['intel_true_scale_psus'] = {
100 'parse_function': parse_intel_true_scale_psus,
101 'inventory_function': inventory_intel_true_scale_psus,
102 'check_function': check_intel_true_scale_psus,
103 'service_description': 'Power supply %s',
104 'snmp_info': (
105 ".1.3.6.1.4.1.10222.2.1.4.7.1",
107 "2", # ICS-CHASSIS-MIB::icsChassisPowerSupplyDescription
108 "3", # ICS-CHASSIS-MIB::icsChassisPowerSupplyOperStatus
109 "4", # ICS-CHASSIS-MIB::icsChassisPowerSupplyInputSource
110 "5", # ICS-CHASSIS-MIB::icsChassisPowerSupplyVoltage
111 "6", # ICS-CHASSIS-MIB::icsChassisPowerSupplyOutputPower
113 'snmp_scan_function': scan_intel_true_scale,
114 'includes': ['intel_true_scale.include', 'elphase.include'],
115 'group': 'el_inphase',