Creepwood & others:
Similar to creepwood's question - does anyone have a suggested schedule for SMART scan? Specifically - which SMART task or tasks and what frequency?
Above referenced thread indicates that NAS emailing with drive failure was not working in earlier versions of FreeNAS 8. Protosd had a work around script. What about FreeNAS 0.8.2? Is email with drive failure working? Or is protosd's workaround script still necessary? Is there a way this can be tested?
I still have not found answers to the above questions. I've now upgraded to 8.0.4. Anyone who can shed some light re: above questions?
It would be nice it you could post your script.
Joeschmuck: Thanks for your suggestions. My CPU / HD temp monitor script seems to be working well now. I've posted my script in case it helps others.
#!/bin/bash
# --------------------------Email Parameters-----------------------------------------
# Set "From"
FROM=******@sbcglobal.net
# Set email subject
SUBJECT="NAS Temperatures (Routine Monthly Report)"
SUBJECT_ALERT="NAS Temperature Alert"
# Set email recipient
TO=******@sbcglobal.net
# Set variable for email body
BODY=""
BODY_ALERT=""
# Set alert temperatures
# Can't find info re: Intel E3-1200 processor temps. Currently running with max around 85F. Saw one 89F.
CORE_ALERT_TEMP=110
# Max Seagate operating temp = 140F (60C). Drives currently running approx 75F
# Script found online used 110 degrees F
HARD_DRIVE_ALERT_TEMP=100
#Set loop variable
LOOP_COUNT=0
PRINTF=/usr/bin/printf
# --------------------------------CPU TEMP------------------------------------------
# CPU temp header
BODY=$BODY`echo "CPU temperatures: \n \n"`
# Check CPU temps
for i in {0..3}
do
CPU_TEMP=`sysctl -n dev.cpu.$i.temperature`
CPU_TEMP=`echo "1.8*${CPU_TEMP}+32" | bc | awk -F. '{print $1}'`
BODY=$BODY`echo -e "CPU Core #$i temperature is ${CPU_TEMP}\xB0F"`
BODY=$BODY`echo "\n"`
# CPU Temperature Alert
if [ ${CPU_TEMP} -gt $CORE_ALERT_TEMP ]; then
if [ ${LOOP_COUNT} == 0 ]; then
LOOP_COUNT=1
BODY_ALERT=$BODY_ALERT`echo "NAS Temperature Alert: \n \n"`
fi
BODY_ALERT=$BODY_ALERT`echo -e "CPU Core #$i temperature is too high measuring ${CPU_TEMP}\xB0F"`
BODY_ALERT=$BODY_ALERT`echo "\n"`
fi
done
# ------------------------------HARD DRIVE TEMP----------------------------------------
# Set # of disks (Not used until adding more disks)
# Disks=`sysctl -an kern.disks`
# Hard drive temp header
BODY=$BODY`echo "\n \nHard drive temperatures: \n \n"`
# Check hard drive temps
for i in ada0 ada1 ada2 ada3 ada4 ada5;
do
HD_TEMP=`smartctl -a /dev/${i} | awk '$2=="Temperature_Celsius"{print $10}'`
HD_TEMP=`echo "1.8*${HD_TEMP}+32" | bc | awk -F. '{print $1}'`
SERIAL=`smartctl -a /dev/$i| awk '/Serial/{print $NF}'`
BODY=$BODY`echo -e "Hard Drive ${i} (serial #${SERIAL}) temperature is ${HD_TEMP}\xB0F"`
BODY=$BODY`echo "\n"`
# Hard Drive Temperature Alert
if [ ${LOOP_COUNT} == 1 ]; then BODY_ALERT=$BODY_ALERT`echo "\n"`; LOOP_COUNT=2; fi
if [ ${HD_TEMP} -gt $HARD_DRIVE_ALERT_TEMP ]; then
if [ ${LOOP_COUNT} == 0 ]; then
LOOP_COUNT=1
BODY_ALERT=$BODY_ALERT`echo "NAS Temperature Alert: \n \n"`
fi
BODY_ALERT=$BODY_ALERT`echo -e "Hard Drive $i (serial #${SERIAL}) temperature is too high measuring ${HD_TEMP}\xB0F"`
BODY_ALERT=$BODY_ALERT`echo "\n"`
fi
done
# ---------------------------------Reporting--------------------------------------------------------------
# Send email with all CPU & hard drive temps on the 1st of each month
DATE=`date +%d`
if [ ${DATE} == 01 ]; then
$PRINTF "$BODY" | mail -s "$SUBJECT" $TO
fi
# If alert message is not null, then email report
if [ "$BODY_ALERT" ]; then
$PRINTF "$BODY_ALERT" | mail -s "$SUBJECT_ALERT" $TO
fi