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 def inventory_dell_om_disks(info
):
28 return [ ("%s:%s:%s" % (x
[3], x
[4], x
[5]) , None) for x
in info
]
30 def check_dell_om_disks(item
, _no_params
, info
):
31 #State definitions. Found in check_openmange from Trond H. Amundsen
33 1 : 'VD member', # disk is a member of a virtual disk
34 2 : 'DG member', # disk is a member of a disk group
35 3 : 'Global HS', # disk is a global hot spare
36 4 : 'Dedicated HS', # disk is a dedicated hot spare
37 5 : 'no', # not a spare
67 22 : 'Replacing', # FIXME: this one is not defined in the OMSA MIBs
72 34 : 'Predictive failure',
80 for name
, dstate
, pid
, eid
, cid
, tid
, sizeMB
, btype
, sstate
, smart
, mt
in info
:
81 ditem
= "%s:%s:%s" % ( eid
, cid
, tid
)
84 dstate
= saveint(dstate
)
85 btype
= saveint(btype
)
86 sstate
= saveint(sstate
)
87 smart
= saveint(smart
)
89 size
= saveint(sizeMB
)*1024*1024
90 msg
= ["%s (%s, %s)" % ( name
, pid
, get_bytes_human_readable(size
) ) ]
94 if dstate
in [ 40, 35, 34, 26, 7, 4]:
97 elif dstate
not in [ 3, 1, 13 ]:
101 # handle hot spares as OK
102 if sstate
in [ 3, 4 ] and dstate
== 1:
106 msg
.append("state %s%s" % ( pdisk_state
.get(dstate
, 'ukn (%s)' % dstate
), label
))
107 msg
.append("Bus Type: %s" % bus_type
.get(btype
,'unk (%s)' % btype
) )
110 msg
.append("Spare State: %s" % spare_state
.get(sstate
, 'ukn (%s)' %sstate
))
112 msg
.append("Media Type: %s" % media_type
.get(mt
,'ukn (%s)' % mt
))
114 return state
, ", ".join(msg
)
115 return 3, "Device not found in SNMP tree"
117 check_info
["dell_om_disks"] = {
118 "check_function" : check_dell_om_disks
,
119 "inventory_function" : inventory_dell_om_disks
,
120 "service_description" : "Physical Disk %s",
121 # There is no other way to find out that openmanage is present.
122 "snmp_scan_function" : scan_dell_om
,
123 "snmp_info" : ( ".1.3.6.1.4.1.674.10893.1.20.130.4.1", [
126 6, # arrayDiskProductID
127 9, # arrayDiskEnclosureID
128 10, # arrayDiskChannel
129 15, # arrayDiskTargetID
130 11, # arrayDiskLengthInMB
131 21, # arrayDiskBusType
132 22, # arrayDiskSpareState
133 #24, #arrayDiskComponentStatus
134 31, #arrayDiskSmartAlertIndication
135 35, # arrayDiskMediaType
137 "includes" : [ "dell_om.include" ],