Dell Perc6/i RAID Monitoring Script using MegaCli

http://www.bxtra.net/articles/2008-09-16/Dell-Perc6i-RAID-Monitoring-Script-using-MegaCli-LSI-CentOS-52-64-bits

I got a Dell Perc6/i Integrated RAID card a few days ago. By using it with CentOS 5.2 64 bits without GUI, I'm looking the way to monitor RAID status. I then, found that I can use MegaCLI from LSI to do the task. (Dell Perc6/i uses LSI Chip)

First, get MegaCLI from LSI website -> MegaCLI 2.00.11 for Linux

Unzip it, and install it by RPM. Files will place at /opt/MegaRAID/MegaCli . However, since I use 64 bits version, the file I got is MegaCli64 . (32 bits OS will get MegaCli instead.

I, then, followed what said on this website (Most information came from that website.)

1. Created a file called "analysis.awk" in the /opt/MegaRAID/MegaCli directory with the following contents:

# 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 <br/>\n", device[i], name_drive[i], state_drive[i]); }

2. Tested by run the command : ./MegaCli64 -PDList -aALL | awk -f analysis.awk

[root@xxxxx MegaCli]# ./MegaCli64 -PDList -aALL | awk -f analysis.awk
Device 00 (ATA ST3xxxxxxxx Sxxx 5xxxxx) status is: Online
Device 01 (ATA ST3xxxxxxxx Sxxx 5xxxxx) status is: Online

3. Create a file raidstatus in /etc/cron.hourly . Put below script in it :

/opt/MegaRAID/MegaCli/MegaCli64 -PdList -aALL | awk -f /opt/MegaRAID/MegaCli/analysis.awk | grep -qEv "*: Online" > /dev/null && echo "Warning: RAID status no longer optimal"

4. Run below command to make the file executable by all users.

chmod a+x /etc/cron.hourly/raidstatus

5. Check where the e-mail notification goes to in CRONTAB. Check this file -> /etc/crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

I didn't change anything in CRONTAB. Instead, I changed that in /etc/aliases file. Specify root : aaa@bbb.com in there. So, that all mail to root will go to aaa@bbb.com

There is no e-mail notification if you run cron task (run-parts /etc/cron.hourly ) by yourself. So, you need to wait for CRON to run automatically and you will get an E-mail.

Below are command that maybe useful :


Command to list Adapter Information :

/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aAll


Command to List all Logical Drives :

/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAll


Command to list all Physical Information :

/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll


To check if cron works, run command :

run-parts /etc/cron.hourly

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值