[EXTERNAL EMAIL]
On 10/10/19 11:10 AM, Cameron Smith wrote:
[EXTERNAL EMAIL]

I install use MegaCLI for this:

MegaCli -PDList -aALL |grep Temperature

Cameron

I went ahead and updated my script to support Drive temperatures.   (See Below).
(Be aware, it is very sensitive to smartctl output format and parsing and makes 
assumptions like that drive temps are all in C)
Also, note that smartctl and megacli (and for that matter, even perccli/storcli 
against megacli) CAN report differing device naming, so use drive
serial numbers as unique cross-references.

For MegaCLI...
NOTE: capitalization and '-' are not needed with 'megacli'.  but, as you can 
see on this system, it can't find the Temp on all my drives.

This system has 4 internal SAS disks (on a PERC 6/i) and an MD1000 w/ SATA 
disks on a PERC 5/E.
# /usr/local/LSI-Tools/megacli pdlist aall | grep Temperature
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature : N/A
Drive Temperature :30C (86.00 F)
Drive Temperature :32C (89.60 F)
Drive Temperature :31C (87.80 F)
Drive Temperature :32C (89.60 F)

gdf= Grown Defects (Revectored/Reallocated)
ucr= Reported Uncorrected
uco= Offline Uncorrected
cdt= Current Drive Temp
elc= Error Log entry count
mdt= Manufacturing Date (not many drives support)
poh= Power On Hours
(NOTE: Serial numbers were sanitized ;))

# /root/scsi-inq-all.sh
[ /dev/bus/0 -d sat+megaraid,18 ]
Hitachi Ultrastar A7K1000 Hitachi HUA721075KLA330            : GK8OA74A 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=37,elc=0) [mdt=, poh=72086]
[ /dev/bus/0 -d sat+megaraid,19 ]
Seagate Barracuda ES ST3750640NS                             :     3BKT 
XXXXXXXXXX (gdf=15,ucr=11,uco=1,pen=1,cdt=37,elc=13) [mdt=, poh=102732]
[ /dev/bus/0 -d sat+megaraid,20 ]
Hitachi Ultrastar A7K1000 Hitachi HUA721075KLA330            : GK8OAJ0A 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=36,elc=0) [mdt=, poh=82103]
[ /dev/bus/0 -d sat+megaraid,21 ]
Toshiba 3.5" MG03ACAxxx(Y) Enterprise HDD TOSHIBA MG03ACA100 :     FL1D 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=31,elc=0) [mdt=, poh=46319]
[ /dev/bus/0 -d sat+megaraid,22 ]
Seagate Barracuda ES ST3750640NS                             :     3BKT 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=37,elc=0) [mdt=, poh=102731]
[ /dev/bus/0 -d sat+megaraid,23 ]
Seagate Barracuda ES ST3750640NS                             :     3BKT 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=39,elc=0) [mdt=, poh=102730]
[ /dev/bus/0 -d sat+megaraid,24 ]
Seagate Constellation ES (SATA 6Gb/s) ST1000NM0011           :     PA09 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=32,elc=0) [mdt=, poh=64298]
[ /dev/bus/0 -d sat+megaraid,25 ]
Seagate Barracuda ES ST3750640NS                             :     3BKT 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=38,elc=0) [mdt=, poh=102732]
[ /dev/bus/0 -d sat+megaraid,26 ]
Seagate Barracuda ES ST3750640NS                             :     3BKT 
XXXXXXXXXX (gdf=0,ucr=1,uco=0,pen=0,cdt=39,elc=1) [mdt=, poh=102730]
[ /dev/bus/0 -d sat+megaraid,27 ]
Seagate Barracuda ES ST3750640NS                             :     3BKT 
XXXXXXXXXX (gdf=2,ucr=0,uco=0,pen=0,cdt=37,elc=0) [mdt=, poh=79635]
[ /dev/bus/0 -d sat+megaraid,28 ]
Western Digital RE3 Serial ATA WDC WD7502ABYS-18W8B1         : 03.00C12 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=37,elc=0) [mdt=, poh=77190]
[ /dev/bus/0 -d sat+megaraid,29 ]
Seagate Constellation ES (SATA) ST31000524NS                 :     KA0A 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=34,elc=0) [mdt=, poh=64563]
[ /dev/bus/0 -d sat+megaraid,30 ]
Seagate Barracuda ES ST3750640NS                             :     3BKT 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=37,elc=0) [mdt=, poh=102730]
[ /dev/bus/0 -d sat+megaraid,31 ]
Seagate Barracuda 7200.10 ST3750640AS                        :    3.AAE 
XXXXXXXXXX (gdf=3,ucr=2,uco=0,pen=0,cdt=34,elc=2) [mdt=, poh=31752]
[ /dev/bus/0 -d sat+megaraid,32 ]
Western Digital RE3 Serial ATA WDC WD1002FBYS-18W8B1         : 03.00C12 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=37,elc=0) [mdt=, poh=75672]
[ /dev/bus/1 -d megaraid,0 ]
SEAGATE ST9300603SS                                          :     FS66 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=30,elc=0) [mdt=, poh=69228]
[ /dev/bus/1 -d megaraid,1 ]
SEAGATE ST9300603SS                                          :     FS66 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=32,elc=0) [mdt=, poh=69228]
[ /dev/bus/1 -d megaraid,2 ]
SEAGATE ST9300603SS                                          :     FS66 
XXXXXXXXXX (gdf=1127,ucr=0,uco=0,pen=0,cdt=31,elc=0) [mdt=, poh=69228]
[ /dev/bus/1 -d megaraid,3 ]
SEAGATE ST9300603SS                                          :     FS66 
XXXXXXXXXX (gdf=0,ucr=0,uco=0,pen=0,cdt=32,elc=0) [mdt=, poh=69228]


#!/bin/sh
# Title:    scsi-inq-all
# Purpose:  use smartctl to list out INQUIRY data and important stats for all 
drives it finds.
# Author:   Stephen Dowdy ([email protected])

# 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

#awk=gawk
#awk=mawk
awk=awk

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][ 
\t]*");mdt=sprintf("%d(w)/%d(y)",foo[4],foo[7]);}
/Power_On_Hours/{tmp=split($0,foo,"[ \t][ \t]*"); poh=foo[tmp]; }
/number of hours powered up/{tmp=split($0,foo,"[ \t][ \t]*=[ \t][ 
\t]*");poh=foo[tmp]}
/Device Error Count/{tmp=split($0,foo,"[ \t][ \t]*"); elc=foo[4]}
/Temperature_Celsius/{tmp=split($0,foo,"[ \t][ \t]*"); cdt=foo[8]; }
/Current Drive Temperature/{tmp=split($0,foo,"[ \t][ \t]*"); cdt=foo[4]}
/Current Temperature:/{tmp=split($0,foo,"[ \t][ \t]*"); cdt=foo[3]}
END{printf("%-60s : %8s %15s (gdf=%d,ucr=%d,uco=%d,pen=%d,cdt=%d,elc=%d) [mdt=%s, 
poh=%d]\n",vendor " " model,firmware,serial,gdf,ucr,uco,pen,cdt,elc,mdt,poh)}
'
done

exit 0

_______________________________________________
Linux-PowerEdge mailing list
[email protected]
https://lists.us.dell.com/mailman/listinfo/linux-poweredge

Reply via email to