On 10/10/19 9:58 AM, Onno Zweers wrote:
Hi all,

Does anyone know how to get the temperature of the disks connected to a Perc 


You should be able to modify this script to also report Temperatures.
(smartmontools' smartctl past some 6.5(?) version supports a MegaRAID passthru)

e.g.  SAS drive might report something like:

Current Drive Temperature:     54 C
(SATA will likely report in an Attribute table element)

# Title:    scsi-inq-all
# Purpose:  use smartctl to list out INQUIRY data and important stats for all 
drives it finds.
# Author:   Stephen Dowdy (sdo...@ucar.edu)

# Ref: https://www.backblaze.com/blog/hard-drive-smart-stats/
# Backblaze uses:
#    SMART 5 – Reallocated_Sector_Count.
#    SMART 187 – Reported_Uncorrectable_Errors.
#    SMART 188 – Command_Timeout.
#    SMART 197 – Current_Pending_Sector_Count.
#    SMART 198 – Offline_Uncorrectable.

# Note that this 'awk' script is designed to only process ONE disk at a time 
(vars are not rezeroed on end-of-records)
# Warn: this script is extremely dependent upon parsing exact output strings 
from 'smartctl', which are subject to change.

# SATA and SAS are reported VERY differently by 'smartctl', so we have to do 
several attempts to string match/parse


smartctl --scan-open | sed -ne '/^\//{s/[ \t]*#.*$//;p}' | \
while read disk; do
    echo "[ ${disk} ]"
#    smartctl -a ${disk} | ${awk} -v 'FS=:[[:space:]][[:space:]]*' '
    smartctl -x ${disk} | ${awk} -v 'FS=[ \t]*:[ \t]*' '
/^(Vendor|Model Family):/{vendor=$2}
/^(Product|Device Model):/{model=$2}
/^(Revision|Firmware Version):/{firmware=$2}
/^(Serial number|Serial Number):/{serial=$2}
/^Elements in grown defect list:/{gdf=$2}
/Reallocated_Sector_Ct/{tmp=split($0,foo,"[ \t][ \t]*"); gdf=foo[tmp]}
/Offline_Uncorrectable/{tmp=split($0,foo,"[ \t][ \t]*"); uco=foo[tmp]}
/Reported_Uncorrect/{tmp=split($0,foo,"[ \t][ \t]*"); ucr=foo[tmp]}
/Current_Pending_Sector/{tmp=split($0,foo,"[ \t][ \t]*"); pen=foo[tmp]}
/^Manufactured in week/{nf=split($0,foo,"[ \t][ 
/Power_On_Hours/{tmp=split($0,foo,"[ \t][ \t]*"); poh=foo[tmp]; }
/number of hours powered up/{tmp=split($0,foo,"[ \t][ \t]*=[ \t][ 
/Device Error Count/{tmp=split($0,foo,"[ \t][ \t]*"); elc=foo[4]}
END{printf("%-60s : %8s %15s (gdf=%d,ucr=%d,uco=%d,pen=%d,elc=%d) [mdt=%s, 
poh=%d]\n",vendor " " model,firmware,serial,gdf,ucr,uco,pen,elc,mdt,poh)}

exit 0

Linux-PowerEdge mailing list

Reply via email to