How to display CPU core temp on dashboard?



  • Hi all,

    I tried following the steps in the following thread: http://forum.pfsense.org/index.php/topic,39595.0.html - and while I can get the temp readout in shell via sysctl -a | grep temperature, I tried doing modifications to the widget and functions file, it didn't go anywhere… no information displayed on the system status section of the dashboard...

    Can someone lead me in the right direction? I have a D525 Atom based system if it matters...

    Thanks!


  • Netgate Administrator

    What have you done exactly?
    What results are you seeing?

    Steve



  • @stephenw10:

    What have you done exactly?
    What results are you seeing?

    Steve

    I've copied the .ko file to /boot/kernel, changed the system_information.widget.php file to show the degree symbol and created a /boot/loader.conf.local to add coretemp_load="yes" so that it'd load at boot.

    I also changed 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() {
    
            $numcores = "";
            exec("/sbin/sysctl -A | grep temperature | wc -l", $dfout);
            $numcores = trim($dfout[0]);
            if($numcores == "0") {
                    return false;
                    } else {
                    return true;
                    }
    }
    
    

    edit: this appeared in the log file:

    kernel: kldload: /boot/kernel/coretemp.ko: Unsupported file layout

    However I can still do the sysctl -a command…


  • Netgate Administrator

    Which version of pfSense are you running?
    Do you have the correct kernel module, 32bit or 64bit?

    In the dashboard widget what are you seeing? Anything temp related or just as before?

    Please post the output of the sysctrl command. You may be seeing an ACPI reading.

    Steve


  • Rebel Alliance

    Agree with Steve; please post the "Full" output of: sysctl -a | grep temperature

    Did you get:

    $ sysctl -a | grep temperature
    hw.acpi.thermal.tz0.temperature: 40.0C

    or:

    $ sysctl -a | grep temperature
    hw.acpi.thermal.tz0.temperature: 40.0C
    dev.cpu.0.temperature: 29.0C
    dev.cpu.1.temperature: 28.0C


  • Netgate Administrator

    No reason not to use ACPI data though.
    You could try the function from 2.1:

    
    function get_temp() {
             $temp_out = "";
             exec("/sbin/sysctl dev.cpu.0.temperature | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d 'C' -f 1", $dfout);
             $temp_out = trim($dfout[0]);
             if ($temp_out == "") {
             exec("/sbin/sysctl hw.acpi.thermal.tz0.temperature | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d 'C' -f 1", $dfout);
             $temp_out = trim($dfout[0]);
             }
             return $temp_out;
    
    

    Steve



  • Hi all,

    I am running pfSense 2.0.1 with the AMD64 kernel (read around that using that for the 64 bit Atom builds ain't a problem).

    I am also using coretemp 64 bit module.

    Running sysctl -a | grep temperature provides the following output:

    dev.cpu.0.temperature: 63.0C
    dev.cpu.1.temperature: 63.0C
    dev.cpu.2.temperature: 67.0C
    dev.cpu.3.temperature: 67.0C

    The dashboard has no indication of anything temperature related…

    Silly question - after modifying the php files, should I reboot pfSense, or does restarting the web configuration would do the trick?


  • Netgate Administrator

    You may also have to refresh the browser or clear the cache.

    Simply changing the line:

    	return true;
    
    

    Should alter the dashboard appearance. If it still looks the same something is cached or the file hasn't saved correctly.

    Steve

    Edit: On my box simply changing that line from false to true shows a temprature bar on the dashboard. No restarting anything, no cache clearing nothing else.  :)



  • Hot! That did it! Thank you good sir :)


Log in to reply