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 # fan 1 durable-id fan_1.1
29 # fan 1 name Fan Loc:left-PSU 1
30 # fan 1 location Enclosure 1 - Left
32 # fan 1 status-numeric 0
35 # fan 1 position-numeric 0
40 # fan 1 health-numeric 0
42 # fan 1 health-recommendation
43 # fan 2 durable-id fan_1.2
44 # fan 2 name Fan Loc:right-PSU 2
45 # fan 2 location Enclosure 1 - Right
47 # fan 2 status-numeric 0
49 # fan 2 position Right
50 # fan 2 position-numeric 1
55 # fan 2 health-numeric 0
57 # fan 2 health-recommendation
60 def inventory_hp_msa_fan(parsed
):
61 for item
in parsed
.keys():
65 def check_hp_msa_fan(item
, params
, parsed
):
67 fan_speed
= int(parsed
[item
]["speed"])
68 fan_state
, fan_state_readable
= \
69 hp_msa_state_map
[parsed
[item
]["status"]]
70 fan_health_state
, fan_health_state_readable
= \
71 hp_msa_state_map
[parsed
[item
]["health"]]
72 fan_health_reason
= parsed
[item
].get("health-reason", "")
74 yield fan_state
, "Status: %s, speed: %s RPM" % (fan_state_readable
, fan_speed
)
76 if fan_health_state
> 0 and fan_health_reason
:
77 yield fan_health_state
, "health: %s (%s)" % \
78 (fan_health_state_readable
, fan_health_reason
)
81 check_info
['hp_msa_fan'] = {
82 'parse_function': parse_hp_msa
,
83 'inventory_function': inventory_hp_msa_fan
,
84 'check_function': check_hp_msa_fan
,
85 'service_description': 'Fan %s',
86 'includes': ["hp_msa.include"],