Display HDD temperature in web interface

From BubbaWiki
Revision as of 08:07, 10 November 2010 by Johannes (talk | contribs)
Jump to navigation Jump to search

Hi,

I think it's nice to be able to see the HDD temperature in the web portal and started digging around. I found out that you already have the functionallity but it doesn't seem to be used anywhere (navigate to http://b3.local/admin/stat/info to get the JSON data). Hence I decided to hack it in myself.

I've attached the patch incase anyone else is interested in seeing it as well. Just make sure you have hddtemp installed (apt-get install hddtemp).

Transfer the patch to your bubba and ssh in, now as root:

cd /usr/share/web-admin/
patch --verbose -p0 < /path/to/gui_hdd.patch


gui_hdd.patch (I'm not allow to upload it as an attachment, make sure there is no trailing empty line):

--- admin/controllers/stat.php.orig 2010-11-06 18:50:38.000000000 +0100
+++ admin/controllers/stat.php 2010-11-06 18:51:36.000000000 +0100
@@ -79,6 +79,7 @@
$sdata['totalspace']=number_format($totalspace,0,' ',' ');
$sdata['percentused']=intval(100*(($totalspace-$freespace)/$totalspace));
$sdata['notifications'] = $this->notify->list_all();
+ $sdata['hddtemp'] = $this->_getdisk('/dev/sda');

if($strip){
$this->load->view(THEME.'/stat/stat_view',$sdata);
--- admin/views/default/stat/stat_view.php.orig   2010-11-06 18:51:02.000000000 +0100
+++ admin/views/default/stat/stat_view.php   2010-11-06 18:47:17.000000000 +0100
@@ -17,6 +17,7 @@
<table class="ui-table-outline" id="ui-stat-list">
<tr><td class="ui-stat-list-col1"><?=t('Disk capacity')?></td><td class="ui-stat-list-col2"><?=$totalspace?> MB</td><td /></tr>
<tr><td><?=t('Available')?></td><td><?=$freespace?> MB</td><td /></tr>
+            <tr><td><?=t('HDD temperature')?></td><td><?=$hddtemp['temp']?></td><td /></tr>
<tr><td><?=t('Uptime')?></td><td>
<? if($uptime[0]>0) print($uptime[0]." ".t('days')." "); ?>
<? printf("%02d",$uptime[1])?>:<? printf("%02d",$uptime[2])?>:<? printf("%02d",$uptime[3])?>


The result:

Gui patch.jpeg


Note: This howto was copied with the writers permission from our forum, and originally written by [vEX]. Our warmest thanks to him/her for this contribution! 


/Johannes (Excito staff)