2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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.
28 # power-supplies 1 durable-id psu_1.1
29 # power-supplies 1 enclosure-id 1
30 # power-supplies 1 serial-number 7CE451T700
31 # power-supplies 1 description FRU,Pwr Sply,595W,AC,2U,LC,HP
32 # power-supplies 1 name PSU 1, Left
33 # power-supplies 1 revision D1
34 # power-supplies 1 model 592267-002
35 # power-supplies 1 vendor 0x
36 # power-supplies 1 location Enclosure 1 - Left
37 # power-supplies 1 position Left
38 # power-supplies 1 position-numeric 0
39 # power-supplies 1 part-number 592267-002
40 # power-supplies 1 dash-level
41 # power-supplies 1 fru-shortname AC Power Supply
42 # power-supplies 1 mfg-date 2014-10-29 16:57:47
43 # power-supplies 1 mfg-date-numeric 1414601867
44 # power-supplies 1 mfg-location Zhongshan,Guangdong,CN
45 # power-supplies 1 mfg-vendor-id 0x
46 # power-supplies 1 configuration-serialnumber 7CE451T700
47 # power-supplies 1 dc12v 1195
48 # power-supplies 1 dc5v 508
49 # power-supplies 1 dc33v 336
50 # power-supplies 1 dc12i 548
51 # power-supplies 1 dc5i 489
52 # power-supplies 1 dctemp 34
53 # power-supplies 1 health OK
54 # power-supplies 1 health-numeric 0
55 # power-supplies 1 health-reason
56 # power-supplies 1 health-recommendation
57 # power-supplies 1 status Up
58 # power-supplies 1 status-numeric 0
60 # .--health--------------------------------------------------------------.
62 # | | |__ ___ __ _| | |_| |__ |
63 # | | '_ \ / _ \/ _` | | __| '_ \ |
64 # | | | | | __/ (_| | | |_| | | | |
65 # | |_| |_|\___|\__,_|_|\__|_| |_| |
67 # +----------------------------------------------------------------------+
69 # '----------------------------------------------------------------------'
71 check_info
['hp_msa_psu'] = {
72 'parse_function': parse_hp_msa
,
73 'inventory_function': inventory_hp_msa_health
,
74 'check_function': check_hp_msa_health
,
75 'service_description': 'Power Supply Health %s',
76 'includes': ["hp_msa.include"],
80 # .--voltage-------------------------------------------------------------.
82 # | __ _____ | | |_ __ _ __ _ ___ |
83 # | \ \ / / _ \| | __/ _` |/ _` |/ _ \ |
84 # | \ V / (_) | | || (_| | (_| | __/ |
85 # | \_/ \___/|_|\__\__,_|\__, |\___| |
87 # '----------------------------------------------------------------------'
90 factory_settings
["hp_msa_psu_default_levels"] = {
91 "levels_33v_lower": (3.25, 3.20),
92 "levels_33v_upper": (3.4, 3.45),
93 "levels_5v_lower": (4.9, 4.8),
94 "levels_5v_upper": (5.1, 5.2),
95 "levels_12v_lower": (11.9, 11.8),
96 "levels_12v_upper": (12.1, 12.2),
100 def inventory_hp_msa_psu(parsed
):
101 return [(key
, {}) for key
in parsed
]
104 def check_hp_msa_psu(item
, params
, parsed
):
107 for psu_type
, psu_type_readable
, levels_type
in [("dc12v", "12 V", "levels_12v_"),
108 ("dc5v", "5 V", "levels_5v_"),
109 ("dc33v", "3.3 V", "levels_33v_")]:
110 psu_voltage
= float(parsed
[item
][psu_type
]) / 100
111 yield state
, "%s: %.2f V" % (psu_type_readable
, psu_voltage
)
113 warn_lower
, crit_lower
= params
[levels_type
+ "lower"]
114 if psu_voltage
< crit_lower
:
115 yield 2, "too low (warn/crit below %.2f V/%.2f V)" % (warn_lower
, crit_lower
)
116 elif psu_voltage
< warn_lower
:
117 yield 1, "too low (warn/crit below %.2f V/%.2f V)" % (warn_lower
, crit_lower
)
119 warn
, crit
= params
[levels_type
+ "upper"]
120 if psu_voltage
>= crit
:
121 yield 2, "too high (warn/crit at %.2f V/%.2f V)" % (warn
, crit
)
122 elif psu_voltage
>= warn
:
123 yield 1, "too high (warn/crit at %.2f V/%.2f V)" % (warn
, crit
)
126 check_info
['hp_msa_psu.sensor'] = {
127 'inventory_function': inventory_hp_msa_psu
,
128 'check_function': check_hp_msa_psu
,
129 'service_description': 'Power Supply Voltage %s',
130 'default_levels_variable': "hp_msa_psu_default_levels",
131 'group': 'hp_msa_psu_voltage',
132 'includes': ["hp_msa.include"],
136 # .--temperature---------------------------------------------------------.
138 # | | |_ ___ _ __ ___ _ __ ___ _ __ __ _| |_ _ _ _ __ ___ |
139 # | | __/ _ \ '_ ` _ \| '_ \ / _ \ '__/ _` | __| | | | '__/ _ \ |
140 # | | || __/ | | | | | |_) | __/ | | (_| | |_| |_| | | | __/ |
141 # | \__\___|_| |_| |_| .__/ \___|_| \__,_|\__|\__,_|_| \___| |
143 # +----------------------------------------------------------------------+
145 factory_settings
["hp_msa_psu_temp_default_levels"] = {
146 "levels": (40, 45), # Just assumed
150 def inventory_hp_msa_psu_temp(parsed
):
151 for key
in parsed
.keys():
155 def check_hp_msa_psu_temp(item
, params
, parsed
):
157 return check_temperature(float(parsed
[item
]["dctemp"]), params
, "hp_msa_psu_temp_%s" % item
)
160 check_info
['hp_msa_psu.temp'] = {
161 'inventory_function': inventory_hp_msa_psu_temp
,
162 'check_function': check_hp_msa_psu_temp
,
163 'service_description': 'Temperature Power Supply %s',
164 'has_perfdata': True,
165 'group': 'temperature',
166 'default_levels_variable': 'hp_msa_psu_temp_default_levels',
167 'includes': ["temperature.include", "hp_msa.include"],