hdd-temp

#!/bin/bash
# set -x;

# 3Ware CLI HDD Temperature 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 HDD Temperature
STATUS_P0=$(tw_cli /c0/p0 show temperature | awk '{print $4}');
STATUS_P1=$(tw_cli /c0/p1 show temperature | awk '{print $4}');
STATUS_P2=$(tw_cli /c0/p2 show temperature | awk '{print $4}');
STATUS_P3=$(tw_cli /c0/p3 show temperature | awk '{print $4}');
STATUS_P4=$(tw_cli /c0/p4 show temperature | awk '{print $4}');
STATUS_P5=$(tw_cli /c0/p5 show temperature | awk '{print $4}');
STATUS_P6=$(tw_cli /c0/p6 show temperature | awk '{print $4}');

MESSAGE0=$(tw_cli /c0/p0 show temperature);
MESSAGE1=$(tw_cli /c0/p1 show temperature);
MESSAGE2=$(tw_cli /c0/p2 show temperature);
MESSAGE3=$(tw_cli /c0/p3 show temperature);
MESSAGE4=$(tw_cli /c0/p4 show temperature);
MESSAGE5=$(tw_cli /c0/p5 show temperature);
MESSAGE6=$(tw_cli /c0/p6 show temperature);
echo -e "${MESSAGE0}\n${MESSAGE1}\n${MESSAGE2}\n${MESSAGE3}\n${MESSAGE4}\n${MESSAGE5}\n${MESSAGE6}";

# Check the status and set return-code
if [ "${STATUS_P0}" -gt "45" ] || [ "${STATUS_P1}" -gt "45" ] || [ "${STATUS_P2}" -gt "45" ] || [ "${STATUS_P3}" -gt "45" ] || [ "${STATUS_P4}" -gt "45" ] || [ "${STATUS_P5}" -gt "45" ] || [ "${STATUS_P6}" -gt "45" ];
then
        # TEMPERATURE must be not OK - ERROR!
        exit 1;
fi
exit 0;