GUI CSS: Removed snapin styles from py modules and added a _snapins.scss for the...
[check_mk.git] / checks / dell_idrac_raid
blob00bd9f2526ce85c370d820725e766be75b4a6849
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2017 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 # example output
30 def inventory_dell_idrac_raid(info):
31 for index, _name, _status in info[0]:
32 yield index, None
35 def check_dell_idrac_raid(item, _no_params, info):
36 translate_status = {
37 "1": (3, "other"),
38 "2": (3, "unknown"),
39 "3": (0, "OK"),
40 "4": (1, "non-critical"),
41 "5": (2, "critical"),
42 "6": (2, "non-recoverable"),
45 for index, name, status in info[0]:
46 if index == item:
47 state, state_readable = translate_status[status]
48 yield state, "Status of %s: %s" % (name, state_readable)
51 check_info['dell_idrac_raid'] = {
52 'inventory_function': inventory_dell_idrac_raid,
53 'check_function': check_dell_idrac_raid,
54 'service_description': 'Raid Controller %s',
55 'snmp_info': [
57 '.1.3.6.1.4.1.674.10892.5.5.1.20.130.1.1',
59 "1", # IDRAC-MIB::controllerNumber
60 "2", # IDRAC-MIB::controllerName
61 "38", # IDRAC-MIB::controllerComponentStatus
62 ]),
64 '.1.3.6.1.4.1.674.10892.5.5.1.20.130.15.1',
66 "1", # IDRAC-MIB::batterNumber
67 "4", # IDRAC-MIB::batteryState
68 "6", # IDRAC-MIB::batteryComponentStatus
69 "21", # IDRAC-MIB::batteryDisplayName
70 ]),
72 'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.1.2.0').startswith(
73 ".1.3.6.1.4.1.674.10892.5"),
77 def inventory_dell_idrac_raid_bbu(info):
78 for index, _status, _comp_status, _name in info[1]:
79 yield index, None
82 def check_dell_idrac_raid_bbu(item, params, info):
83 translate_bbu_status = {
84 "1": (3, "UNKNOWN"),
85 "2": (0, "READY"),
86 "3": (2, "FAILED"),
87 "4": (1, "DEGRADED"),
88 "5": (3, "MISSING"),
89 "6": (1, "CHARGING"),
90 "7": (2, "BELOW THRESHOLD"),
93 for index, status, _comp_status, _name in info[1]:
94 if index == item:
95 state, state_readable = translate_bbu_status[status]
96 yield state, "Battery status: %s" % state_readable
99 check_info['dell_idrac_raid.bbu'] = {
100 'inventory_function': inventory_dell_idrac_raid_bbu,
101 'check_function': check_dell_idrac_raid_bbu,
102 'service_description': 'Raid BBU %s',