Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agents/check_mk_agent.freebsd
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ fi
# http://www.lsi.com/DistributionSystem/AssetDocument/support/downloads/megaraid/miscellaneous/linux/2.00.15_Linux_MegaCLI.zip
#if which MegaCli >/dev/null ; then
# echo '<<<megaraid_pdisks>>>'
# MegaCli -PDList -aALL -NoLog < /dev/null | egrep 'Enclosure|Raw Size|Slot Number|Device Id|Firmware state|Inquiry'
# MegaCli -PDList -aALL -NoLog < /dev/null | egrep 'Enclosure|Raw Size|Slot Number|Device Id|Firmware state|Inquiry|Predictive Failure Count'
# echo '<<<megaraid_ldisks>>>'
# MegaCli -LDInfo -Lall -aALL -NoLog < /dev/null | egrep 'Size|State|Number|Adapter|Virtual'
#fi
Expand Down
2 changes: 1 addition & 1 deletion agents/check_mk_agent.linux
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ if type MegaCli >/dev/null ; then
echo -n " $part"
done
echo
MegaCli -PDList -aALL -NoLog < /dev/null | egrep 'Enclosure|Raw Size|Slot Number|Device Id|Firmware state|Inquiry|Adapter'
MegaCli -PDList -aALL -NoLog < /dev/null | egrep 'Enclosure|Raw Size|Slot Number|Device Id|Firmware state|Inquiry|Adapter|Predictive Failure Count'
echo '<<<megaraid_ldisks>>>'
MegaCli -LDInfo -Lall -aALL -NoLog < /dev/null | egrep 'Size|State|Number|Adapter|Virtual'
echo '<<<megaraid_bbu>>>'
Expand Down
16 changes: 11 additions & 5 deletions checks/megaraid_pdisks
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def megaraid_pdisks_parse(info):
return_var = []
adapter = 0
enclosure_devid = -181
predictive_failure_count = -1
for line in info:
if line[0] == 'adapter':
current_adapter = {}
Expand Down Expand Up @@ -85,14 +86,16 @@ def megaraid_pdisks_parse(info):

elif line[0] == "Slot":
slot = int(line[-1])
elif line[0] == "Predictive" and line[1] == "Failure" and line[2] == "Count:":
predictive_failure_count = line[3]
elif line[0] == "Firmware" and line[1] == "state:":
state = line[2]
elif line[0] == "Inquiry" and line[1] == "Data:":
name = " ".join(line[2:])
#Adapter, Enclosure, Encolsure Device ID, Slot, State, Name
return_var.append((megaraid_pdisks_adapterstr[adapter],
adapters[adapter][enclosure_devid],
enclosure_devid, slot, state, name))
enclosure_devid, slot, state, name, predictive_failure_count))

return return_var

Expand All @@ -101,17 +104,20 @@ def inventory_megaraid_pdisks(info):

info = megaraid_pdisks_parse(info)
inventory = []
for adapter, enclosure, enc_dev_id, slot, state, name in info:
for adapter, enclosure, enc_dev_id, slot, state, name, predictive_failure_count in info:
inventory.append(("%s%s/%s" % (adapter, enclosure, slot), repr(state)))
return inventory

def check_megaraid_pdisks(item, target_state, info):
info = megaraid_pdisks_parse(info)
for adapter, enclosure, enc_dev_id, slot, state, name in info:
for adapter, enclosure, enc_dev_id, slot, state, name, predictive_failure_count in info:
if "%s%s/%s" % (adapter, enclosure, slot) == item:
infotext = "%s (%s)" % (state, name)
infotext = "%s (%s) (predictive fail count: %s)" % (state, name, predictive_failure_count)
if state == target_state:
return (0, infotext)
if predictive_failure_count <= 0:
return (0, infotext)
else:
return (1, infotext)
else:
return (2, infotext)
return (3, "No disk in encl/slot %s found" % item)
Expand Down