hyram
Dabbler
- Joined
- Jan 16, 2015
- Messages
- 10
I think the best you will get is the Lifetime(hours) of when the test was run.
Yeah, that's all I've found to. Hoping someone else know's another way.
I think the best you will get is the Lifetime(hours) of when the test was run.
#!/bin/bash ### Parameters ### timelogfile="/tmp/smart_time_log.tmp" drives="ada0 ada1 ada2 ada3 ada4 ada5" ### Delete any old log file ### rm ${timelogfile} ###### Run tests ###### for drive in $drives do ( echo -n -e ${drive}" Short test completed " smartctl -t short /dev/${drive} | grep 'after' | tail -c 25 ) >> ${timelogfile} done
. . . ### Parameters ### logfile="/tmp/smart_report.tmp" timelogfile="/tmp/smart_time_log.tmp" . . . ###### for each drive ###### for drive in $drives do brand=`smartctl -i /dev/${drive} | grep "Model Family" | awk '{print $3, $4, $5}'` serial=`smartctl -i /dev/${drive} | grep "Serial Number" | awk '{print $3}'` ( echo "" echo "########## SMART status report for ${drive} drive (${brand}: ${serial}) ##########" smartctl -n never -H -A -l error /dev/${drive} smartctl -n never -l selftest /dev/${drive} | grep "# 1 \|Num" | cut -c6- echo "" grep ${drive} ${timelogfile} | cut -d " " -f2- echo "" ) >> ${logfile} done . . .
. . . No Errors Logged Test_Description Status Remaining LifeTime(hours) LBA_of_first_error Short offline Completed without error 00% 2337 - Short test completed Mon Mar 23 17:49:48 2015 . . .
freenas# ./zpool-report.sh Failed conversion of ``2015-Mar-30_19:25:25'' using format ``%Y-%b-%e_%H:%M:%S'' date: illegal time format usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] ./zpool-report.sh: arithmetic expression: expecting primary: "((1428229269 - ) + 43200) / 86400"
freenas# sh cpudisplay.sh cpu.0.temperature: 47 C cpu.1.temperature: 46 C cpu.2.temperature: 48 C cpu.3.temperature: 48 C ada0 WD-WCC4ME0TENL1: 36 C ada1 WD-WCC4M7L93SC4: 37 C ada2 WD-WCAZAD467709: 35 C ada3 WD-WMC4N1223410: 36 C ada4 Z4Z1XZFF : 38 C
[root@freenas1] ~# sh temps.sh cpu.0.temperature: 47 C cpu.1.temperature: 41 C cpu.2.temperature: 45 C cpu.3.temperature: 42 C cpu.4.temperature: 45 C cpu.5.temperature: 42 C cpu.6.temperature: 40 C cpu.7.temperature: 42 C da0 : C da1 : C da2 : C da3 : C da4 : C da5 : C da6 : C da7 : C [root@freenas1] ~# smartctl -i /dev/da1 smartctl 6.3 2014-07-26 r3976 [FreeBSD 9.3-RELEASE-p12 amd64] (local build) Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Vendor: WD Product: WD4001FYYG-01SL3 Revision: VR07 Compliance: SPC-4 User Capacity: 4,000,787,030,016 bytes [4.00 TB] Logical block size: 512 bytes Rotation Rate: 7200 rpm Form Factor: 3.5 inches Logical Unit id: 0x50000c0f01e1273c Serial number: WMC1F8675309 Device type: disk Transport protocol: SAS (SPL-3) Local Time is: Mon Apr 6 17:54:45 2015 EDT SMART support is: Available - device has SMART capability. SMART support is: Enabled Temperature Warning: Enabled [root@freenas1] ~# smartctl -A /dev/da1 smartctl 6.3 2014-07-26 r3976 [FreeBSD 9.3-RELEASE-p12 amd64] (local build) Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org === START OF READ SMART DATA SECTION === Current Drive Temperature: 30 C Drive Trip Temperature: 69 C Manufactured in week 10 of year 2014 Specified cycle count over device lifetime: 1048576 Accumulated start-stop cycles: 415 Specified load-unload count over device lifetime: 1114112 Accumulated load-unload cycles: 0 Elements in grown defect list: 0 [root@freenas1] ~#
serial=`smartctl -i /dev/${drive} | grep "Serial Number" | awk '{print $3}'` temp=`smartctl -A /dev/${drive} | grep "Temperature_Celsius" | awk '{print $10}'`
serial=`smartctl -i /dev/${drive} | grep "Serial number" | awk '{print $3}'` temp=`smartctl -A /dev/${drive} | grep "Current Drive Temperature" | awk '{print $4}'`
Sorry for the delay, was out of the house. Btw. this used to work for me, I just had recently messed up my configuration and had to reinstall freeNAS and since then it gave me this issue.Yeah, I don't see anything wrong.
What version of FreeNAS you use? (the complete one, with the update number in the line, you can see it in the system tab of the GUI)
#!/bin/bash ### Define parametros de alerta ### temp_max=35 # Temperatura em graus celcius email="seu_endereco_de_email" # E-mail do destinatario do alerta assunto="FreeNAS: Alerta de temperatura HDD" # Assunto do email # Define variavel de graus celcius CEL=$'\xe2\x84\x83' # Monta array de discos do sistema arrdiscs=($(camcontrol devlist | awk '{print substr($NF, 8, length($NF)-8)}')) # Cria array para alerta de temperatura alertdiscs=() # Recupera a temperatura dos discos com base no arrdiscs for i in "${arrdiscs[@]}" do temp=("$(smartctl -A "/dev/$i" | egrep ^194 | awk '{print $10}')") if [ -n "$temp" ] && [ $temp -gt $temp_max ]; then alertdiscs+=("[$i]: $temp$CEL") fi done # Compara os valores de temperatura com a variavel temp_max e gera alerta if [ ${#alertdiscs[@]} -gt 0 ]; then # Envia email de alerta printf "%b\n" "Discos com temperatura acima do limite ($temp_max$CEL):\n${alertdiscs[@]}" | /usr/bin/mail -s "$assunto" "$email" fi
used=`zpool list -H -o capacity ${pool} | cut -d'%' -f1`