raidstatus

#!/bin/bash
# set -x;

# 3Ware CLI RAID Report
#
# https://martinlanner.com/2013/08/24/3ware-raid-status-script/
#
# You will need to install the tw_cli utility which you can
# download for free from www.3ware.com or you can get it from
# 3rd party repositories.

##########################################################
#  Do NOT edit below unless you know what you're doing.  #
##########################################################

# Get info on RAID status
STATUS_U0=$(tw_cli info c0 u0 status | awk '{print $4}');
STATUS_U1=$(tw_cli info c0 u1 status | awk '{print $4}');

MESSAGE=$(tw_cli info);
echo "${MESSAGE}";

# Check the status and set return-code
if [ "${STATUS_U0}" != "OK" ] || [ "${STATUS_U1}" != "OK" ];
then
        # RAID must be not OK - ERROR!
        exit 1;
fi
exit 0;