Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 428628

Summary: sys-block/megacli monitoring script
Product: Gentoo Linux Reporter: Oleg Gawriloff <barzog>
Component: New packagesAssignee: Sysadmin Bugs <sysadmin>
Status: RESOLVED WONTFIX    
Severity: enhancement CC: kbonner, kfm, ramereth
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Oleg Gawriloff 2012-07-30 08:59:47 UTC
It would be nice if we have some kind of daily monitoring for megaraid arrays. Based on http://www.bxtra.net/comment/137.
in /etc/cron.daily/mega-status:

#!/bin/bash
megacli -PdList -aALL | awk -f /root/bin/mega-status.awk | grep -Ev "*: Online"

in /root/bin/mega-status.awk:

# This is a little AWK program that interprets MegaCLI output
    /Device Id/ { counter += 1; device[counter] = $3 }
    /Firmware state/ { state_drive[counter] = $3 }
    /Inquiry/ { name_drive[counter] = $3 " " $4 " " $5 " " $6 }
  END {
    for (i=1; i<=counter; i+=1) printf ( "Device %02d (%s) status is: %s \n", device[i], name_drive[i], state_drive[i]); }

So in case of failure we have nice message:

peerbox-r1 bin # /etc/cron.daily/mega-status
Device 12 (9VS2ZCM5ST31500341AS CC1H  ) status is: Rebuild


PS: May be some further commands should be added, i.e. in case of rebuild 
Using:
megacli -PdList -aALL - get the list of drives and its ID:
Enclosure Device ID: 252
Slot Number: 4
Inquiry Data:             9VS2ZCM5ST31500341AS                            CC1H

then
peerbox-r1 bin # megacli -PDRbld -ShowProg -PhysDrv [252:4] -aALL
Rebuild Progress on Device at Enclosure 252, Slot 4 Completed 6% in 34 Minutes.
Comment 1 Lance Albertson (RETIRED) gentoo-dev 2012-12-24 18:12:26 UTC
I've used a modified version of this nagios plugin from the nagios exchange [1] to deal with the monitoring of megaraid devices. I don't think having a cronjob by default is a good decision, however I don't have a problem of including this in a contrib folder.

Will that be OK?

[1] http://exchange.nagios.org/directory/Plugins/Hardware/Storage-Systems/RAID-Controllers/check_snmp_raid--2F-check_sasraid_megaraid/details
Comment 2 Oleg Gawriloff 2013-01-07 17:05:25 UTC
Yes, anything that does the job will do.
Comment 3 Kevin Bonner 2013-07-31 06:50:43 UTC
We use a modified version of check_megaraid_sas from the Nagios Exchange[1].  I see the check_sasraid_megaraid was updated within the past few months (rather than 3+ years), but wanted to provide an alternative that I've had success with for a couple years.

[1] http://exchange.nagios.org/directory/Plugins/Hardware/Storage-Systems/RAID-Controllers/check_megaraid_sas/details
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2016-02-09 00:57:11 UTC
If anybody still cares about this, package check_megaraid_sas from nagios directly, and include an optional cronjob to check it; leave the megacli ebuild itself alone.