hpacucli on Linux

Original article here

Using hpacucli to manage RAID.

Create a single disk RAID0 (How i use Ceph on my HP DL180's)

1 hpacucli ctrl slot=2 create type=ld drives=1I:1:8 raid=0 

Show all logical volumes

 1[root@management ~]# hpacucli controller slot=0 logicaldrive all show
 2
 3Smart Array P410i in Slot 0 (Embedded)
 4
 5array A
 6
 7logicaldrive 1 (136.4 GB, RAID 1, OK)
 8
 9array B
10
11logicaldrive 2 (1.4 TB, RAID 5, Recovering, 52% complete)
12

Script to E-Mail in case of RAID failure

 1#!/bin/bash
 2###
 3#If something went wrong with the HP smartarray disks this script will send an error email
 4>###
 5MAIL=notifications@domain.com.au
 6HPACUCLI=`which hpacucli`
 7HPACUCLI_TMP=/tmp/hpacucli.log
 8 if [ `/usr/sbin/uname26 hpacucli controller slot=2 physicaldrive all show | grep -e 'Fail\\|Rebuil\\|err\\|prob' -i | wc -l` -gt 0 ] 
 9 then 
10 echo failure 
11 msg="RAID Controller Errors" 
12 #echo $msg 
13 #$msg2=`hpacucli controller slot=1 physicaldrive all show` 
14 logger -p syslog.error -t RAID "$msg" 
15 echo "Hostname: " $HOSTNAME >> $HPACUCLI_TMP 
16 /usr/sbin/uname26 $HPACUCLI controller slot=2 physicaldrive all show >> $HPACUCLI_TMP 
17 mail -s "$HOSTNAME [ERROR] - $msg" -r RaidError@domain.com.au "$MAIL" < $HPACUCLI_TMP 
18 rm -f $HPACUCLI_TMP 
19 #else 
20 #echo "Everything Good" 
21 fi