GUI CSS: Removed snapin styles from py modules and added a _snapins.scss for the...
[check_mk.git] / checks / hp_msa_fan
blob0033633d2442f06b077f23a0cb8436b0d5095c34
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 # <<<hp_msa_fan>>>
28 # fan 1 durable-id fan_1.1
29 # fan 1 name Fan Loc:left-PSU 1
30 # fan 1 location Enclosure 1 - Left
31 # fan 1 status Up
32 # fan 1 status-numeric 0
33 # fan 1 speed 3760
34 # fan 1 position Left
35 # fan 1 position-numeric 0
36 # fan 1 serial-number
37 # fan 1 fw-revision
38 # fan 1 hw-revision
39 # fan 1 health OK
40 # fan 1 health-numeric 0
41 # fan 1 health-reason
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
46 # fan 2 status Up
47 # fan 2 status-numeric 0
48 # fan 2 speed 3880
49 # fan 2 position Right
50 # fan 2 position-numeric 1
51 # fan 2 serial-number
52 # fan 2 fw-revision
53 # fan 2 hw-revision
54 # fan 2 health OK
55 # fan 2 health-numeric 0
56 # fan 2 health-reason
57 # fan 2 health-recommendation
60 def inventory_hp_msa_fan(parsed):
61 for item in parsed.keys():
62 yield item, None
65 def check_hp_msa_fan(item, params, parsed):
66 if item in 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"],