How to: Get CPU temp
-
Nope, it's still doing the same thing for me. I guess I'll have to wait until someone develops a system package. Not a big deal. I'm just curious why it's not showing a temperature, even though I can query through a sysctl statement and get 4 temperatures (with HyperThreading, two temperatures really). Thanks all! I'll still keep an eye on this thread.
jim
-
You should really use °, don't hardcode such a symbol directly in html/js
-
The Intel 386 coretemp file works for the VIA architecture as well. I followed the instructions on page 1 of this thread and changed /usr/local/www/includes/functions.inc.php to use "hw.acpi.thermal" instead of "dev.cpu.0.temperature".
Works a champ until an update then I need to reinstall the coretemp.ko module and modify functions.inc.php again.
My version of /usr/local/www/includes/functions.inc.php
function has_temp() { /* no known temp monitors available at present */ /* should only reach here if there is no hardware monitor */ return true; } function get_temp() { $temp_out = ""; exec("/sbin/sysctl hw.acpi.thermal | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d 'C' -f 1", $dfout); $temp_out = trim($dfout[0]); return $temp_out; }
-
Put the .ko files in /boot/modules and not /boot/kernel, then they won't go away after every update and they still will load as expected.
-
I would think it would be better to have the get_temp function return a value including the ° symbol.
E.g. 45.2°
That way only one file has to be altered.You should really use °, don't hardcode such a symbol directly in html/js
I agree. I was surprised it worked actually. It probably depends on what your viewing it on.
Steve
-
Using something like:
function get_temp() { $temp_out = ""; exec("/usr/local/bin/mbmon -I -c1 -T3", $dfout); $temp_out = (trim($dfout[0]).'°'); return $temp_out; }
Would be better except that the above code only correctly returns ° when it it called from the system widget php code. When it's called from the javascript update function it just shows °. :-\
Steve
-
Needs a semicolon after that, it's "°"
-
I would think it would be better to have the get_temp function return a value including the ° symbol.
E.g. 45.2°
That way only one file has to be altered.You should really use °, don't hardcode such a symbol directly in html/js
I agree. I was surprised it worked actually. I probably depends on what your viewing it on.
Steve
Steve and jimp,
Sorry for been slow, but what you say is I should not really add the ° symbol to the ajax.js file? But could I add the ASCII code there or better not at all? As I mentioned I am not a good programmer :(
Steen -
Yeah, this still isn't working for me. I'm just going to wait until a package is released.
-
It's bad form (invalid html/js/etc) to put in a symbol instead of the html entity. It may work, but it's not guaranteed to do so.
http://www.w3schools.com/tags/ref_entities.asp
-
Nope. ???
Same as before, using:unction get_temp() { $temp_out = ""; exec("/usr/local/bin/mbmon -I -c1 -T3", $dfout); $temp_out = (trim($dfout[0]).'°'); return $temp_out; }
Results in initially correct ° then 46.5°C
Hmm.Steve
-
It may be getting run through htmlentities somewhere in there then. Might be safe to leave the symbol in there if that is the case.
-
Unfortunately using:
function get_temp() { $temp_out = ""; exec("/usr/local/bin/mbmon -I -c1 -T3", $dfout); $temp_out = (trim($dfout[0]).'°'); return $temp_out; }
Results in the attached image.
Perhaps the character set is being restricted somewhere?
-
That's a unicode degree symbol, try a standard ascii one, º
-
It's bad form (invalid html/js/etc) to put in a symbol instead of the html entity. It may work, but it's not guaranteed to do so.
http://www.w3schools.com/tags/ref_entities.asp
OK, got you, yes correct…
Cheers Steen -
No different. I entered both º and ° and both result in ��. :-\
Steve
-
I'd just leave it out.
(Or convert to Kelvin, no symbol there! ;-)
-
Kelvin nice! :D
I'll stick with the nasty ° addition to ajax.js. I'm clueless about js, how would one enter that as an ascii code instead? Using ° is not working.
Steve
-
I'd just leave it out.
(Or convert to Kelvin, no symbol there! ;-)
Kelvin - LoL can core temp convert the output?
-
This is awesome. My i3-540 reads 29C, 29C, 36C, 36C lol.
Will this be included in future snapshots? Or should we go ahead and modify it ourselves?