Difference between revisions of "Display HDD temperature in web interface"

From BubbaWiki
Jump to navigation Jump to search
Line 6: Line 6:


Transfer the patch to your bubba and ssh in, now as root:<br>  
Transfer the patch to your bubba and ssh in, now as root:<br>  
<pre>cd /usr/share/web-admin/
<pre>apt-get install hddtemp
cd /usr/share/web-admin/
patch --verbose -p0 &lt; /path/to/gui_hdd.patch</pre>  
patch --verbose -p0 &lt; /path/to/gui_hdd.patch</pre>  
<br>gui_hdd.patch:<br>  
<br>gui_hdd.patch:<br>  

Revision as of 10:05, 10 November 2010

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:

apt-get install hddtemp
cd /usr/share/web-admin/
patch --verbose -p0 < /path/to/gui_hdd.patch


gui_hdd.patch:

--- 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 by Excito with the writers permission from our forum, and originally written by [vEX]. Our warmest thanks to him/her for this contribution!