New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

Display the HDD temperature in the web portal [patch]

A collection of tips on howto tweak your Bubba.
johannes
Posts: 1470
Joined: 31 Dec 2006, 07:12
Location: Sweden
Contact:

Re: Display the HDD temperature in the web portal [patch]

Post by johannes »

Of course, thanks. Fixed.
/Johannes (Excito co-founder a long time ago, but now I'm just Johannes)
artoo
Posts: 16
Joined: 12 Aug 2011, 13:20

Re: Display the HDD temperature in the web portal [patch]

Post by artoo »

Could anyone please fix the patch so that it works with the latest updates?
Maybe Excito could make the temperature info default in the next version? :)
Mirador
Posts: 9
Joined: 10 Aug 2011, 10:24

Re: Display the HDD temperature in the web portal [patch]

Post by Mirador »

After updating software to Version 2.3 the temperature display is gone and I didn´t succeed in installing it again, I get this message:

Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -urN admin//controllers/stat.php ../admin/controllers/stat.php
|--- admin//controllers/stat.php 2010-09-30 14:32:21.000000000 +0200
|+++ ../admin/controllers/stat.php 2010-11-10 11:21:15.000000000 +0100
--------------------------
Patching file admin//controllers/stat.php using Plan A...
Hunk #1 FAILED at 79.
1 out of 1 hunk FAILED -- saving rejects to file admin//controllers/stat.php.rej
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -urN admin//views/default/stat/stat_view.php ../admin/views/default/stat/stat_view.php
|--- admin//views/default/stat/stat_view.php 2010-09-30 14:32:33.000000000 +0200
|+++ ../admin/views/default/stat/stat_view.php 2010-11-10 11:22:10.000000000 +0100
--------------------------
Patching file admin//views/default/stat/stat_view.php using Plan A...
Hunk #1 FAILED at 17.
1 out of 1 hunk FAILED -- saving rejects to file admin//views/default/stat/stat_view.php.rej
done

does the patch need some enhancements in order to work again?

kind regards,

Mirador
Gordon
Posts: 1461
Joined: 10 Aug 2011, 03:18

Re: Display the HDD temperature in the web portal [patch]

Post by Gordon »

artoo wrote:Could anyone please fix the patch so that it works with the latest updates?
Maybe Excito could make the temperature info default in the next version? :)
Okay...

Code: Select all

---\sadmin/controllers/stat.php\t2011-08-03\s16:11:51.000000000\s+0200
+++\sadmin.patched/controllers/stat.php\t2011-08-17\s10:22:51.000000000\s+0200
@@\s-85,7\s+85,8\s@@\sclass\sStat\sextends\sController{
\s\t\t$sdata['totalspace']=number_format($totalspace,0,'\s','\s');
\s\t\t$sdata['percentused']=intval(100*(($totalspace-$freespace)/$totalspace));
\s\t\t$sdata['notifications']\s=\s$this->notify->list_all();
-\s\s\s\s\s\s\s\s$sdata['printers']\s=\s$this->_getprinters();
+\t\t$sdata['hddtemp']\s=\s$this->_getdisk('/dev/sda');
+\t\t$sdata['printers']\s=\s$this->_getprinters();
\s
\s\t\tif($strip){
\s\t\t\t$this->load->view(THEME.'/stat/stat_view',$sdata);
---\sadmin/views/default/stat/stat_view.php\t2011-08-05\s13:58:50.000000000\s+0200
+++\sadmin.patched/views/default/stat/stat_view.php\t2011-08-17\s10:23:14.000000000\s+0200
@@\s-24,6\s+24,10\s@@
\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s<td><?=$freespace?>\sMB</td>
\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s</tr>
\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s<tr>
+\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s<td\sclass="ui-stat-list-col1"><?=t('HDD\stemperature')?></td>
+\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s<td><?=$hddtemp['temp']?></td>
+\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s</tr>
+\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s<tr>
\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s<td\sclass="ui-stat-list-col1"><?=t('Uptime')?></td>
\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s<td>
\s\t\t\t\t\t\t<?\sif($uptime[0]>0)\sprint($uptime[0]."\s".t('days')."\s");\s?>
Replace all instances of `\s` to a single space character and each `\t` to a tab character
KennethP
Posts: 5
Joined: 24 Nov 2010, 12:51
Location: Copenhagen, Denmark

Re: Display the HDD temperature in the web portal [patch]

Post by KennethP »

Hi guys.

As a long time lurker in this forum, and being a very satisfied customer/owner of the Bubba B3/2TB/WLAN beautybox, the time has now come for my first (serious) post and support question.

It seems that I just can't get this "Display HDD temperature in web interface" thing to work after the 2.3.0.x upgrade.
http://wiki.excito.org/wiki/index.php/D ... _interface
(It worked flawlessly before this upgrade)

I must admit that I didn't try the patch, but took the diffs from the gui_hdd.patch file and made the changes directly in the relevant files.
I ssh'ed into the server, changed to root and used nano for the editing.


In the file /usr/share/web-admin/admin/controllers/stat.php

Code: Select all


function info(){

		$sdata["version"] = get_package_version('bubba-frontend');
		$sdata['uptime'] = uptime();
		$sdata['partitions']["home"] = $this->_getvolume('/home/');
		$sdata['partitions']["system"] = $this->_getvolume('/');
		$sdata['disks']["sda"] = $this->_getdisk('/dev/sda');
		$sdata['hddtemp'] = $this->_getdisk('/dev/sda');
		$sdata['printers'] = $this->_getprinters();

		header("Content-type: application/json");
		print json_encode($sdata);
	}

In the file /usr/share/web-admin/admin/views/default/stat/stat_view.php

Code: Select all

                <tr>
                    <td class="ui-stat-list-col1"><?=t('HDD temperature')?>$
                    <td><?=$hddtemp['temp']?></td>
                </tr>
Gives the following php-error:
Image

hddtemp is installed, and this command (as root in terminal):

Code: Select all

hddtemp /dev/sda
Gives me the following promising result:

Code: Select all

/dev/sda: WDC WD20EARS-00MVWB0: 44°C
I've tried the obvious things like changing labeltext, commenting out code etc. and seeing that it is actually the correct files that I'm working on...;-)
Being a php noob, and realizing that my ancient COBOL coding skills from way back doesn't help me that much here, I hope you guys can give me a hand.
Any hints or pointers to get this working is appreciated.

@excito: when will we see this functionality as built into the gui? :P

Thanks in advance

Kenneth
Gordon
Posts: 1461
Joined: 10 Aug 2011, 03:18

Re: Display the HDD temperature in the web portal [patch]

Post by Gordon »

In the patch I posted above, you could have read that patching of stat.php should start at line 85. The correct place for the hddtemp entry is in the function called `index`, not `info`.

To automagically fetch and convert the previous post to a working patch file, run the following command on your B3

Code: Select all

wget "http://forum.excito.net/viewtopic.php?f=8&t=2662&start=15" -O /dev/stdout \
| grep -A 12 "<div id=\"p16536\"" | grep "<code>" \
|  sed "s/^.*<code>//" | sed "s/<\/code>.*$//" \
|  sed "s/<br[^>]*>/\n/g" |  sed "s/"/\"/g" \
|  sed "s/</</g" |  sed "s/>/>/g" \
|  sed "s/&#91;/\[/g" |  sed "s/&#93;/\]/g" \
|  sed "s/\\\s/ /g" \
|  sed "s/\\\t/\t/g" > gui-hddtemp.patch
Patch as described in the wiki
KennethP
Posts: 5
Joined: 24 Nov 2010, 12:51
Location: Copenhagen, Denmark

Re: Display the HDD temperature in the web portal [patch]

Post by KennethP »

:oops:

Thanks, Gordon - I'll fiddle a little with that!

I learned a lesson or two today about patch files, and I better dive into patching things the proper way I can see...

Kenneth
johannes
Posts: 1470
Joined: 31 Dec 2006, 07:12
Location: Sweden
Contact:

Re: Display the HDD temperature in the web portal [patch]

Post by johannes »

Feature request understood, we'll add this to our vanilla release from the planned 2.4 (a few months away).
/Johannes (Excito co-founder a long time ago, but now I'm just Johannes)
Puma
Posts: 230
Joined: 29 Sep 2008, 06:30

Re: Display the HDD temperature in the web portal [patch]

Post by Puma »

Hello,

Temperature in Bubbamon is still working great!

If you are using mozilla firefox plugin.

Puma
Linux is like a wigwam - no windows, no gates, apache inside!
artoo
Posts: 16
Joined: 12 Aug 2011, 13:20

Re: Display the HDD temperature in the web portal [patch]

Post by artoo »

If I have a Bubba Storage, can I get the temperature from both hdds?
Puma
Posts: 230
Joined: 29 Sep 2008, 06:30

Re: Display the HDD temperature in the web portal [patch]

Post by Puma »

Hello,

If hhdtemp is installed you can see the hdd of the bubba (sda) and the storage (sdb)

log in as root: with su

then:
hddtemp /dev/sda
hddtemp /dev/sdb

You will get something like: WDC WD10000.... : 40 C.

Via bubbamon you will get only sdb your bubba harddrive temp.

This is the most important temperature (it wil get approx. 3 or 4 degrees hotter then the storage).


Hoping to have you informed sufficiently,

Regards,

Puma
Linux is like a wigwam - no windows, no gates, apache inside!
emil_12
Posts: 17
Joined: 30 Jan 2012, 13:56

Re: Display the HDD temperature in the web portal [patch]

Post by emil_12 »

i get this error

Patching file admin//views/default/stat/stat_view.php using Plan A...
Hunk #1 FAILED at 17.
1 out of 1 hunk FAILED -- saving rejects to file admin//views/default/stat/stat_view.php.rej
done

any ideas ?
pulp
Posts: 19
Joined: 10 Mar 2012, 07:22

Re: Display the HDD temperature in the web portal [patch]

Post by pulp »

Exactly the same error occurs on my system:

Code: Select all

Patching file admin//views/default/stat/stat_view.php using Plan A...
Hunk #1 FAILED at 17.
1 out of 1 hunk FAILED -- saving rejects to file admin//views/default/stat/stat_view.php.rej
done
I am running software version 2.4
Why is this not yet implemented in the default system?

Thanks,
P
Gordon
Posts: 1461
Joined: 10 Aug 2011, 03:18

Re: Display the HDD temperature in the web portal [patch]

Post by Gordon »

New patch file...

unpack with command (I'm not allowed to attach a file with .patch extension)

Code: Select all

tar -xzf gui-hddtemp.tgz 
Attachments
gui-hddtemp.tgz
HDD temperature patch for B3 software version 2.4
(635 Bytes) Downloaded 754 times
pmd
Posts: 1
Joined: 09 Aug 2012, 09:49

Re: Display the HDD temperature in the web portal [patch]

Post by pmd »

The latest patch file works partly for version 2.5.0.2 .

The first of the two patches is applied, but the second one fails.
This is because there is now a new item ('Available') between 'Disk capacity' and 'Uptime'.

I added the extra lines by hand, and I can now see the disk temperature on the status page of the B3 web interface.

Could someone who is more familiar with creating patch files than me perhaps fix the patch file?
Post Reply