User Tools

Site Tools


computing:storage:lsi:megaraid_monitor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
computing:storage:lsi:megaraid_monitor [2013/01/21 14:59]
gcooper created
computing:storage:lsi:megaraid_monitor [2018/11/01 10:55] (current)
gcooper
Line 1: Line 1:
 ====== Monitoring LSI SAS RAID Controllers on Linux ====== ====== Monitoring LSI SAS RAID Controllers on Linux ======
  
-FIXME This page needs updating.+See also **[[computing:storage:lsi:megaraid|LSI MegaRAID]]** 
 + 
 +**Cheat Sheet**: http://tools.rapidsoft.de/perc/ 
 + 
 +**LSI MegaRAID SAS User's Guide**: http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/MegaRAID_SAS_SW_UG_51530-00_RevI.pdf
  
 This configuration uses ''cron'' and the MegaCLI RAID configuration utility to monitor a Linux server with a newer LSI SAS RAID controller. This configuration uses ''cron'' and the MegaCLI RAID configuration utility to monitor a Linux server with a newer LSI SAS RAID controller.
Line 16: Line 20:
  
 <file> <file>
-vim /etc/ssmtp/ssmtp.conf+vi /etc/ssmtp/ssmtp.conf
  
 root=admin@yourdomain.com root=admin@yourdomain.com
Line 37: Line 41:
 ==== Install the MegaCLI Utility ==== ==== Install the MegaCLI Utility ====
  
-Log in as 'root', then:+See also **[[computing:storage:lsi:megaraid|LSI MegaRAID]]**
  
-cd ~ +==== cron ====
-wget -O MegaCLI.zip http://www.lsi.com/DistributionSystem/User/AssetMgr.aspx?asset=56619 +
-unzip MegaCLI.zip +
-rpm -ivh MegaCli-8.01.06-1.i386.rpm Lib_Utils-1.00-08.noarch.rpm+
  
-Cron +Added to ''/etc/crontab'' to run the script every 10 minutes:
- +
-I added this to my /etc/crontab:+
  
 +<file>
 # check for RAID array problems every 10 minutes and send out a message # check for RAID array problems every 10 minutes and send out a message
 */10 * * * * root /root/raid-status-megacli.sh 2>&1 */10 * * * * root /root/raid-status-megacli.sh 2>&1
 +</file>
  
-Script+==== raid-status-megacli.sh ====
  
-I wrote this script. I just place it in the /root directory.  You will want to edit the variables to fit your needs. +Place this script in the ''/root'' directory and make it executable: 
-More Info + 
-Cheat Sheet +<file> 
-LSI MegaRAID SAS User'Guide+chmod +x /root/raid-status-megacli.sh 
 +</file> 
 + 
 +You will want to edit the variables to fit your needs. 
 + 
 +<file> 
 +#!/bin/bash 
 +
 +# raid-status-megacli.sh - Gene Cooper <gcooper at sonoracomm.com> 
 +
 +# For newer LSI RAID controllers 
 +
 +# Uses MegaCLI utility and sendmail command and should be run from cron 
 + 
 +# Sender of e-mail warnings 
 +# For WHMCS Ticket System, use the contact address here for automatic account assignment 
 +FROM='"RAID Status" <user@domain.com>' 
 + 
 +# Subject of e-mail warning 
 +SUBJECT="RAID Array Failure on `hostname`" 
 + 
 +# Recipient of e-mail warnings 
 +ADMIN='"Your Name" <you@yourdomain.com>' 
 + 
 +# RAID utility check command 
 +COMMAND='/opt/MegaRAID/MegaCli/MegaCli -ldinfo -Lall -Aall -NoLog' 
 + 
 +# RAID status check results 
 +STATUS='/root/raidinfo.txt' 
 + 
 +# dump hardware failure info to a text file 
 +nice -n 19 ${COMMAND} > $STATUS 
 + 
 +# Comment this section and run manually to test mail sending 
 +# Check for error 
 +if [ -z "$(grep "^State.*: Degraded$" $STATUS | awk '{print $NF}')" ]; then 
 +  exit 0 
 +fi 
 + 
 +# Send mail 
 +/usr/sbin/sendmail -t -i <<EOF 
 +Date: $(date) 
 +To:  $ADMIN 
 +Subject: $SUBJECT 
 +From: $FROM 
 + 
 +$(cat $STATUS) 
 + 
 +EOF 
 +exit 
 +</file> 
 + 
 +Here is someone else'script for ideas: 
 + 
 +<file> 
 +#!/bin/sh 
 +CONT="a0" 
 +STATUS=0 
 +MEGACLI=/opt/MegaRAID/MegaCli/MegaCli64 
 + 
 +echo -n "Checking RAID status on " 
 +hostname 
 +for a in $CONT 
 + do 
 + 
 +   NAME=`$MEGACLI -AdpAllInfo -$a |grep "Product Name" | cut -d: -f2` 
 +   echo "Controller $a: $NAME" 
 +   noonline=`$MEGACLI PDList -$a | grep Online | wc -l` 
 +   echo "No of Physical disks online : $noonline" 
 +   DEGRADED=`$MEGACLI -AdpAllInfo -a0  |grep "Degrade"
 +   echo $DEGRADED 
 +   NUM_DEGRADED=`echo $DEGRADED |cut -d" " -f3` 
 +   [ "$NUM_DEGRADED" -ne 0 ] && STATUS=1 
 +   FAILED=`$MEGACLI -AdpAllInfo -a0  |grep "Failed Disks"
 +   echo $FAILED 
 +   NUM_FAILED=`echo $FAILED |cut -d" " -f4` 
 +   [ "$NUM_FAILED" -ne 0 ] && STATUS=1 
 + 
 + done 
 + 
 +exit $STATUS 
 +</file>
computing/storage/lsi/megaraid_monitor.1358805588.txt.gz · Last modified: 2013/01/21 14:59 by gcooper