2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2014 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.674.10892.5.5.1.20.130.4.1.2.1 Physical Disk 0:1:0 --> IDRAC-MIB::physicalDiskName.1
28 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.2.2 Physical Disk 0:1:1 --> IDRAC-MIB::physicalDiskName.2
29 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.4.1 8 --> IDRAC-MIB::physicalDiskState.1
30 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.4.2 8 --> IDRAC-MIB::physicalDiskState.2
31 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.11.1 1144064 --> IDRAC-MIB::physicalDiskCapacityInMB.1
32 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.11.2 1144064 --> IDRAC-MIB::physicalDiskCapacityInMB.2
33 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.22.1 1 --> IDRAC-MIB::physicalDiskSpareState.1
34 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.22.2 1 --> IDRAC-MIB::physicalDiskSpareState.2
35 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.24.1 3 --> IDRAC-MIB::physicalDiskComponentStatus.1
36 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.24.2 3 --> IDRAC-MIB::physicalDiskComponentStatus.2
37 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.31.1 0 --> IDRAC-MIB::physicalDiskSmartAlertIndication.1
38 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.31.2 0 --> IDRAC-MIB::physicalDiskSmartAlertIndication.2
39 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.55.1 Disk 0 in Backplane 1 of Integrated RAID Controller 1 --> IDRAC-MIB::physicalDiskDisplayName.1
40 # .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.55.2 Disk 1 in Backplane 1 of Integrated RAID Controller 1 --> IDRAC-MIB::physicalDiskDisplayName.2
43 def inventory_dell_idrac_disks(info
):
46 inventory
.append((line
[0], None))
50 def check_dell_idrac_disks(item
, _no_params
, info
):
67 "4": (0, "non-critical"),
69 "6": (1, "non-recoverable"),
72 "1": (0, "no-operation"),
73 "2": (1, "REBUILDING"),
74 "3": (1, "data-erased"),
75 "4": (1, "COPY-BACK"),
79 map_spare_state_info
= {
81 "2": "dedicated hotspare",
82 "3": "global hotspare",
85 for disk_name
, disk_state
, capacity_MB
, spare_state
, \
86 component_state
, smart_alert
, diskpower_state
, display_name
in info
:
88 yield 0, "[%s] Size: %s" % \
89 (display_name
, get_bytes_human_readable(int(capacity_MB
) * 1024 * 1024))
91 for what
, what_key
, what_text
in [(disk_state
, "disk_states", "Disk state"),
92 (component_state
, "component_states",
94 state
, state_readable
= map_states
[what_key
][what
]
95 yield state
, "%s: %s" % (what_text
, state_readable
)
97 if smart_alert
!= "0":
98 yield 2, "Smart alert on disk"
100 if spare_state
!= "1":
101 yield 0, map_spare_state_info
[spare_state
]
103 if diskpower_state
!= "1":
104 state
, state_readable
= map_states
["diskpower_states"][diskpower_state
]
105 yield state
, "%s" % (state_readable
)
108 check_info
["dell_idrac_disks"] = {
109 "check_function": check_dell_idrac_disks
,
110 "inventory_function": inventory_dell_idrac_disks
,
111 "service_description": "Disk %s",
112 "snmp_scan_function": lambda oid
: oid('.1.3.6.1.2.1.1.2.0') == ".1.3.6.1.4.1.674.10892.5",
114 ".1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1",
116 "2", # physicalDiskName
117 "4", # physicalDiskState
118 "11", # physicalDiskCapacityInMB
119 "22", # physicalDiskSpareState
120 "24", # physicalDiskComponentStatus
121 "31", # physicalDiskSmartAlertIndication
122 "50", # physicalDiskPowerState
123 "55", # physicalDiskDisplayName