#!/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
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