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

From BubbaWiki
Jump to navigation Jump to search
Line 5: Line 5:
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).  
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:<br>  
Transfer the patch to your bubba and ssh in. Then do:<br>  
<pre>apt-get install hddtemp
<pre>apt-get install hddtemp
cd /usr/share/web-admin/
cd /usr/share/web-admin/
su (use password 'excito')
wget download.excito.net/software/gui_hdd.patch
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>
<pre>--- 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-&gt;notify-&gt;list_all();
+ $sdata['hddtemp'] = $this-&gt;_getdisk('/dev/sda');


if($strip){
 
$this-&gt;load-&gt;view(THEME.'/stat/stat_view',$sdata);
[Edit:&nbsp;It didn't work well to screen copy/paste the patch for some reason (spaces vs tabs etc.), so we uploaded the patch file to a server for direct download.]
--- 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 @@
 
&lt;table class="ui-table-outline" id="ui-stat-list"&gt;
The result:  
&lt;tr&gt;&lt;td class="ui-stat-list-col1"&gt;&lt;?=t('Disk capacity')?&gt;&lt;/td&gt;&lt;td class="ui-stat-list-col2"&gt;&lt;?=$totalspace?&gt; MB&lt;/td&gt;&lt;td /&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;?=t('Available')?&gt;&lt;/td&gt;&lt;td&gt;&lt;?=$freespace?&gt; MB&lt;/td&gt;&lt;td /&gt;&lt;/tr&gt;
+            &lt;tr&gt;&lt;td&gt;&lt;?=t('HDD temperature')?&gt;&lt;/td&gt;&lt;td&gt;&lt;?=$hddtemp['temp']?&gt;&lt;/td&gt;&lt;td /&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;?=t('Uptime')?&gt;&lt;/td&gt;&lt;td&gt;
&lt;? if($uptime[0]&gt;0) print($uptime[0]." ".t('days')." ");&nbsp;?&gt;
&lt;? printf("%02d",$uptime[1])?&gt;:&lt;? printf("%02d",$uptime[2])?&gt;:&lt;? printf("%02d",$uptime[3])?&gt;</pre>
<br>The result:  


[[Image:Gui patch.jpeg]]<br>  
[[Image:Gui patch.jpeg]]<br>  

Revision as of 10:36, 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. Then do:

apt-get install hddtemp
cd /usr/share/web-admin/
su (use password 'excito')
wget download.excito.net/software/gui_hdd.patch
patch --verbose -p0 < /path/to/gui_hdd.patch


[Edit: It didn't work well to screen copy/paste the patch for some reason (spaces vs tabs etc.), so we uploaded the patch file to a server for direct download.]


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!