Can I see the spinup/down state on GUI ?
Posted: 23 Feb 2014 13:19
Is there any place on the GUI where I can see the power state of my hdds?
Welcome to the XigmaNAS community forum!
https://www.xigmanas.com/oldforums/
https://www.xigmanas.com/oldforums/viewtopic.php?f=59&t=6092
Currently I'm working on an extension (named Extended GUI = eGUI) which incorporates inter alia the spinup/down states of hdds. The work is in progress but if you want you can try it, it is easy to install and to remove if it's not worth for you at all.drnicolas wrote:looks complicated
Code: Select all
cd /mnt/DATA/extensions
fetch https://dl.dropboxusercontent.com/u/36565301/shared/extensions/extended-gui.tar.gz
tar xzvf extended-gui.tar.gz
rm extended-gui.tar.gz
./extended-gui-install.php
Code: Select all
# camcontrol devlist | awk -F\( '{print $2'} | awk -F\, '{print $1}'
pass0
pass1
pass2
pass3
pass4
pass5
pass6
pass7
pass8
Code: Select all
#!/bin/sh
# filename: hd_status.sh
# author: Andreas Schmidhuber
camcontrol devlist | awk -F\( '{print $2'} | awk -F\, '{print $1}' |while read LINE
do
DEVICE_NAME=`echo $LINE`
if [ $? != 0 ]; then
DEVICE_NAME=`echo $LINE`;
fi
smartctl -n standby -q silent /dev/$DEVICE_NAME
case $? in
2) MSG="STANDBY";;
0) MSG="ACTIVE";;
esac;
echo "Disk: $DEVICE_NAME -> $MSG "
done
Code: Select all
#!/bin/sh
camcontrol devlist | awk -F\( '{print $2'} | awk -F\, '{print $1}' |while read LINE
do
DEVICE_NAME=`echo $LINE`
smartctl -n standby -q silent -A /dev/$DEVICE_NAME
case $? in
2) MSG=" Standby"; MSG_TEMP="n/a";;
0) MSG="Spinning"; MSG_TEMP=`smartctl -n standby -A /dev/$DEVICE_NAME | awk '/Temperature_Celsius/ {print $10}'`;;
esac;
echo "Disk: $DEVICE_NAME -> $MSG | Temperature: $MSG_TEMP "
done
Thank you for the feedback!ChriZathens wrote:Hi, crest, just tested your extension, but unfortunately it does not work for me. In index I see no temperatures and also no disk activity. Only search function in logs work![]()
Perhaps due to different device names?
Code: Select all
echo exec("sh /var/scripts/hd_status.sh {$diskusagev['filesystem']}");Code: Select all
./hd_status.sh /dev/ada1p1Code: Select all
# camcontrol devlist
<VBOX HARDDISK 1.0> at scbus0 target 0 lun 0 (ada0,pass0)
<VBOX HARDDISK 1.0> at scbus0 target 1 lun 0 (ada1,pass1)
<VBOX CD-ROM 1.0> at scbus1 target 0 lun 0 (cd0,pass2)
<VBOX HARDDISK 1.0> at scbus1 target 1 lun 0 (ada2,pass3)
<VBOX HARDDISK 1.0> at scbus2 target 0 lun 0 (ada3,pass4)
<VBOX HARDDISK 1.0> at scbus3 target 0 lun 0 (ada4,pass5)
<VBOX HARDDISK 1.0> at scbus4 target 0 lun 0 (ada5,pass6)
<VBOX HARDDISK 1.0> at scbus5 target 0 lun 0 (ada6,pass7)
<VBOX HARDDISK 1.0> at scbus6 target 0 lun 0 (ada7,pass8)Code: Select all
# camcontrol devlist | awk -F\( '{print $2'} | awk -F\, '{print $1}'
ada0
ada1
cd0
ada2
ada3
ada4
ada5
ada6
ada7
Code: Select all
# sh hd_status.sh /dev/da0
[: 38: unexpected operator
df: /dev/da0: Invalid argument
[: -lt: unexpected operator
[: -lt: unexpected operator
</td><td style='width:90px'>|| Disk: /dev/da0 </td><td style='width:70px'>-> <font color=red><b>Spinning</b></font> </td><td style='width:105px'>| Temperatur: <font color=darkblue><b>38 °C °C</b></font> </td><td>
Code: Select all
$ /mnt/hd_status
Disk: pass0 -> Spinning | Temperature: 40
Disk: pass1 -> Spinning | Temperature: 39
Disk: pass2 -> Spinning | Temperature: 37
Disk: pass3 -> Spinning | Temperature: 28
Disk: pass4 -> Spinning | Temperature: 31
Disk: pass5 -> Spinning | Temperature: 33
Disk: pass6 -> Spinning | Temperature: 34
Disk: pass7 -> Spinning | Temperature: 34 Code: Select all
/hd_status.sh /dev/pass7
df: /dev/pass7: Block device required
[: -lt: unexpected operator
[: -lt: unexpected operator
</td><td style='width:90px'>|| Disk: /dev/pas </td><td style='width:70px'>-> <font color=black><b>Unknown</b></font> </td><td style='width:105px'>| Temperatur: n/a </td><td>First of all a big THANK YOU for your great support and - yes, I enjoy staying here for another 2 month, left the cold time at home, thanks to Skype and Teamviewer ...ChriZathens wrote:Hello again, crest!
You are in Crete? Lucky you!
Nice to have you in Greece, I hope it is not strictly business; and some pleasure is included.
Code: Select all
# sh hd_status.sh /dev/da0
[: 38: unexpected operator
df: /dev/da0: Invalid argument
[: -lt: unexpected operator
[: -lt: unexpected operator
</td><td style='width:90px'>|| Disk: /dev/da0 </td><td style='width:70px'>-> <font color=red><b>Spinning</b></font> </td><td style='width:105px'>| Temperatur: <font color=darkblue><b>38 °C °C</b></font> </td><td>
... I'm a bit puzzled because the script output goes straight to the index page (beside the unexpected errors above which comes from the /dev/da0 without the partition ...), there is nothing in the output after the free space values, like this?The script itself seems to retrieve the info, but the extension won't show anything, unfortunately...

... this I don't understand too, because when I tried your suggested commandBut as you can see above, my disks are shown as passx
Code: Select all
camcontrol devlist | awk -F\( '{print $2'} | awk -F\, '{print $1}'True, passx is not possible but I supposed that the index page handover is the adaXY instead of passX, weired.It cannot read passx devices. This would be an explanation, but if it could not read the info, then it would not display the temperatures. However it does display them correctly, it is just the activity that is shown n/a. So my best guess is that the script somehow does manage to retrieve dax devices correctly, but cannot get the activity somehow?
Yes, sure.I am asking because your script is supposed to not weak the disks to retrieve the temperature, right?
Code: Select all
echo exec("sh {$config['extended-gui']['rootfolder']}files/hd_status.sh {$diskusagev['filesystem']}");Code: Select all
echo " | DEVICE: {$diskusagev['filesystem']}";The only device I have with partition is da8 (da8a1). But it is the usb stick for the embedded OS which cannot provide its info anyway. All the other disks have no partitionscrest wrote: ... please can you try this again with sh hd_status.sh /dev/da1p1 or sh hd_status.sh /dev/da1s1 (depending on your hardware) because the script expects also the partition number (which is provided by the original index.php).
No, this is what I see normally(extension not installed): and this is what I see after I install the extension and activate "extended"... I'm a bit puzzled because the script output goes straight to the index page (beside the unexpected errors above which comes from the /dev/da0 without the partition ...), there is nothing in the output after the free space values, like this?
Here is the output:I got all adaX as you can see in my former posting. Do you get a similiar output as me if you only use camcontrol devlist (perhaps not because of you LSI 3081E-R SAS Controller)?
Code: Select all
# camcontrol devlist
<ATA ST31500541AS CC34> at scbus4 target 25 lun 0 (pass0,da0)
<ATA ST1500DL003-9VT1 CC3C> at scbus4 target 26 lun 0 (pass1,da1)
<ATA ST31500541AS CC34> at scbus4 target 27 lun 0 (pass2,da2)
<ATA SAMSUNG HD154UI 1118> at scbus4 target 28 lun 0 (pass3,da3)
<ATA SAMSUNG HD204UI 0001> at scbus4 target 29 lun 0 (pass4,da4)
<ATA SAMSUNG HD204UI 0001> at scbus4 target 30 lun 0 (pass5,da5)
<ATA SAMSUNG HD204UI 0001> at scbus4 target 31 lun 0 (pass6,da6)
<ATA SAMSUNG HD204UI 0001> at scbus4 target 32 lun 0 (pass7,da7)
<Kingston DataTraveler 2.0 1.00> at scbus6 target 0 lun 0 (pass8,da8)
In line 541 this is what I have :A last test to clarify things - could you please replace the line 541 in YOUR_EXTENSION_DIRECTORY/extended-gui/files/index_opt.phpwithCode: Select all
echo exec("sh {$config['extended-gui']['rootfolder']}files/hd_status.sh {$diskusagev['filesystem']}");and change in WebGUI Extensions | Extended GUI the type to standard, then save and again the type to Extended and save to activate the changes and send me the part of the index screen which shows now the device names.Code: Select all
echo " | DEVICE: {$diskusagev['filesystem']}";
Code: Select all
echo exec("sh /var/scripts/hd_status.sh {$diskusagev['filesystem']}");Code: Select all
https://dl.dropboxusercontent.com/u/36565301/shared/extensions/extended-gui.tar.gzCode: Select all
539 "<span name='diskusage_{$ctrlid}_used' id='diskusage_{$ctrlid}_used' class='used' style='display:inline-block; width:30px; text-align:right; font-wei
ght:bold; color:blue'>{$diskusagev['used']}</span>",
540 "<span name='diskusage_{$ctrlid}_free' id='diskusage_{$ctrlid}_free' class='free' style='display:inline-block; width:30px; text-align:right; font-wei
ght:bold; color:green'>{$diskusagev['avail']}</span>");
541 echo exec("sh /var/scripts/hd_status.sh {$diskusagev['filesystem']}");
542 echo "</div></td></tr>";
Code: Select all
echo exec("sh /var/scripts/hd_status.sh {$diskusagev['filesystem']}");Code: Select all
echo exec("sh {$config['extended-gui']['rootfolder']}files/hd_status.sh {$diskusagev['filesystem']}");Code: Select all
echo exec("sh {$config['extended-gui']['rootfolder']}files/hd_status.sh {$diskusagev['filesystem']}");Code: Select all
echo " | DEVICE: {$diskusagev['filesystem']}";Thank YOU for your efforts!Thank you in advance!!!
Regards
crest
YES, you got it, this was the reason! On the index page the drive states are not implemented for ZFS because behind one pool there are usally more than one drive.ChriZathens wrote: OMG, does it actually work with ZFS pools yet, or am i giving you headaches for nothing???
my second fault, I fiddled around searching for the reason and copied the wrong string ...What the heck... am I using wrong script version???? (I got it from ...
Code: Select all
# camcontrol devlistOh, OK, I see.. At least we now know what is wrong!crest wrote: YES, you got it, this was the reason! On the index page the drive states are not implemented for ZFS because behind one pool there are usally more than one drive.
But don't worry about headaches, of course it was my fault not to mention this![]()
No worries! Enjoy your stay at Greece and it will be ready when it is ready..The output ofis for some reason different - (adaX, passX) on my system and vice versa on yours. Strange ...Code: Select all
# camcontrol devlist
Could be the reason why the Activity in Status | Disks is not working ... hmm, I must postbone this issue until May (back home from Crete)
Yes I can confirm it .Btw, can you confirm that after running your script -
several times the drives are still in standby and not spinning up? This was a discussion in the other topic viewtopic.php?f=56&t=5007 we had and for me it is still unpredictable when and why this happen ...
Ok, that's good to know. I will try to include ZFS pool drives to the index page, perhaps you can give it a try too, when I'm finished with it.ChriZathens wrote: Yes I can confirm it .
Just run it over 20 times...
However I saw that there is some kind of bug with it - almost like mixing da3 with da8 . I will look into it...
But it won't spinup the drives (at least in my NAS) - that's for sure!!!
Just FYI, I would like to add, that due to my LSI, my disks do not spin down automatically. I have a cron job which issues a "camcontrol stop dax" command every 30 minutes.
I don't know if it makes any difference, but I thought I should mention it
Hello again ChriZathens!ChriZathens wrote:Yes I can confirm it .crest wrote: Btw, can you confirm that after running your script -
several times the drives are still in standby and not spinning up? This was a discussion in the other topic viewtopic.php?f=56&t=5007 we had and for me it is still unpredictable when and why this happen ...
Just run it over 20 times...
However I saw that there is some kind of bug with it - almost like mixing da3 with da8 . I will look into it...
But it won't spinup the drives (at least in my NAS) - that's for sure!!!
Just FYI, I would like to add, that due to my LSI, my disks do not spin down automatically. I have a cron job which issues a "camcontrol stop dax" command every 30 minutes.
I don't know if it makes any difference, but I thought I should mention it
Code: Select all
zpool list -vHCode: Select all
pool: Media
state: ONLINE
scan: scrub repaired 0 in 6h23m with 0 errors on Mon Mar 10 20:10:58 2014
config:
NAME STATE READ WRITE CKSUM
Media ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
da1 ONLINE 0 0 0
da0 ONLINE 0 0 0
da2 ONLINE 0 0 0
da3 ONLINE 0 0 0
errors: No known data errors
pool: Media2
state: ONLINE
scan: scrub repaired 0 in 7h7m with 0 errors on Tue Mar 11 17:24:17 2014
config:
NAME STATE READ WRITE CKSUM
Media2 ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
da5 ONLINE 0 0 0
da7 ONLINE 0 0 0
da6 ONLINE 0 0 0
da4 ONLINE 0 0 0
errors: No known data errorsGREAT, THANKS A LOT FOR TRYING AND THIS FAST FEEDBACKChriZathens wrote: zpool list -vH does not spinup the drives.
So I just tried your new extension and in main page I can now see my drives!
Yes, I know. I didn't work on this page, this will be one of my next steps.ChriZathens wrote: I cannot see the activity (shows as n/a) in Status|Disks, though.
Don't know if it was supposed to work there, yet, though..
Yes, the live view is also on my listChriZathens wrote: I needed to refresh the webui in order to see the change, however (just FYI)
Nice work!!
P.S.: As you can see, the da devices are not in order. It is not your scripts fault.
Thank you very muchraulfg3 wrote:thanks a lot, your hard work is very promissing.
some new blood are always welcome....
ChriZathens wrote:You rock, man!
THANK YOU!crowi wrote:Hi Crest,
nice extension, thanks a lot for your work!
![]()
![]()
![]()
![]()
Cheers,
Crowi
I released just now an extension where you can see the drive states, see viewtopic.php?f=71&t=6405#p35442drnicolas wrote:looks complicated