Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How to: Get CPU temp

    2.0-RC Snapshot Feedback and Problems - RETIRED
    24
    140
    115.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Micro
      last edited by

      Hi Guys,
      I'm still trying to make the coretemp module working but it seems I'm doing something wrong because it still doesn't work  :'(.
      I extracted the coretemp.ko from the FreeBSD 8.1 distribution iso and put it to /boot/kernel through a SCP connection authenticated as root.
      run the kldload command and tried the command sysctl -a | grep temperature but it returns nothing.

      I had no error when typing "kldload coretemp" so it should works !!!

      My pfsense box is a Watchguard Firebox X700 hardware which runs on Intel Celeron 1200MHz.
      This CPU should be supported by coretemp no ?

      Please Help me.

      Thanks in advance for your support.

      The biggest security issue is …. you !!!

      HW : Watchguard Firebox x700
      CPU : Intel Celeron 1.2GHz
      RAM : 256MB

      1 Reply Last reply Reply Quote 0
      • S
        seh2000
        last edited by

        @Micro:

        Hi Guys,
        I'm still trying to make the coretemp module working but it seems I'm doing something wrong because it still doesn't work  :'(.
        I extracted the coretemp.ko from the FreeBSD 8.1 distribution iso and put it to /boot/kernel through a SCP connection authenticated as root.
        run the kldload command and tried the command sysctl -a | grep temperature but it returns nothing.

        I had no error when typing "kldload coretemp" so it should works !!!

        My pfsense box is a Watchguard Firebox X700 hardware which runs on Intel Celeron 1200MHz.
        This CPU should be supported by coretemp no ?

        Please Help me.

        Thanks in advance for your support.

        Try with the core temp file Steve posted here - I used that one and it worked.
        Steen

        1 Reply Last reply Reply Quote 0
        • A
          asterix
          last edited by

          If you are using SCP to transfer the file.. ensure that you transfer the file in binary format. I had similar issue with WinSCP.

          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            @Micro:

            My pfsense box is a Watchguard Firebox X700 hardware which runs on Intel Celeron 1200MHz.
            This CPU should be supported by coretemp no ?

            The coretemp driver only supports Intel Core cpus and newer.  ;)

            You have to use mbmon for older hardware such as the X700, which is Pentium 3 age.

            Steve

            1 Reply Last reply Reply Quote 0
            • S
              serangku
              last edited by

              Awesome …

              I have to try this on my own box

              thanks

              1 Reply Last reply Reply Quote 0
              • S
                seh2000
                last edited by

                @asterix:

                If you are using SCP to transfer the file.. ensure that you transfer the file in binary format. I had similar issue with WinSCP.

                With the file from Steve I had no issue even when using WinSCP…
                Steen

                1 Reply Last reply Reply Quote 0
                • S
                  seh2000
                  last edited by

                  Anyone had success to get all 4 temperatures to be shown in the dashboard?
                  That would really be neat.
                  Also, will an snapshot update break everything?

                  Steen

                  1 Reply Last reply Reply Quote 0
                  • R
                    RedRep
                    last edited by

                    A snapshot would require you to re-edit the function file, other than that it will be fine.

                    Displaying multiple cores will take a little work.  I've only programmed in Java before and I haven't really had time to sit down and take a look as far as exactly what needs to be added functionality wise.  Right now, the function file returns true/false as far as if you can get temp and the cpu temp itself.  It would need to return the number of cores and the temperatures of each core.

                    1 Reply Last reply Reply Quote 0
                    • S
                      seh2000
                      last edited by

                      @RedRep:

                      A snapshot would require you to re-edit the function file, other than that it will be fine.

                      Displaying multiple cores will take a little work.  I've only programmed in Java before and I haven't really had time to sit down and take a look as far as exactly what needs to be added functionality wise.  Right now, the function file returns true/false as far as if you can get temp and the cpu temp itself.  It would need to return the number of cores and the temperatures of each core.

                      Yep, just did the latest snapshot update, so back to the editing board :)
                      Cheers Steen
                      Update:
                      After the snapshot update I had to recopy the coretemp.ko file to /boot/kernel/, then edit the system_information_widget.php file and edit the functions.inc.php file then I was back to "normal".

                      Cheers Steen

                      1 Reply Last reply Reply Quote 0
                      • M
                        Micro
                        last edited by

                        @stephenw10:

                        @Micro:

                        My pfsense box is a Watchguard Firebox X700 hardware which runs on Intel Celeron 1200MHz.
                        This CPU should be supported by coretemp no ?

                        The coretemp driver only supports Intel Core cpus and newer.  ;)

                        You have to use mbmon for only hardware such as the X700, which is Pentium 3 age.

                        Steve

                        Thanks for the info Steve !!!

                        Now I have installed the mbmon package and I'm able to get system informations like FAN RPM, CPU and chipset temp from shell.
                        I've modified the Get_Temp function code in the system_information.widget.php as follow :

                        
                        function get_temp() {
                        $temp_out = "";
                        exec("mbmon -c1 | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d ',' -f 1", $dfout);
                        $temp_out = trim($dfout[0]);
                        
                        return $temp_out;
                        
                        ```}
                        
                        This works fine in the shell.
                        
                        I created the file /boot/loader.conf.local with "coretemp_load="yes"" inside (even if I'm not really sure that in my case it will be useful).
                        
                        At this time, the "system information" widget in the dashboard of pfsense doesn't show the cpu temp.
                        Is there anything else to do when using mbmon instead of coretemp to make temperature info working ?
                        
                        Thanks for your support.
                        
                        Micro.

                        The biggest security issue is …. you !!!

                        HW : Watchguard Firebox x700
                        CPU : Intel Celeron 1.2GHz
                        RAM : 256MB

                        1 Reply Last reply Reply Quote 0
                        • stephenw10S
                          stephenw10 Netgate Administrator
                          last edited by

                          I phrased that badly.
                          I've only ever used mbmon from the command line.
                          It would be nice to have it work with the GUI though.

                          Steve

                          1 Reply Last reply Reply Quote 0
                          • M
                            Micro
                            last edited by

                            Oups,
                            I mean I modified the code in the function.inc.php file, not in system_information.widget.php

                            Micro.

                            The biggest security issue is …. you !!!

                            HW : Watchguard Firebox x700
                            CPU : Intel Celeron 1.2GHz
                            RAM : 256MB

                            1 Reply Last reply Reply Quote 0
                            • C
                              Cino
                              last edited by

                              I'm not a programmer but a couple of months ago we had a topic about about supermicro boards with ipmi builts.. http://forum.pfsense.org/index.php/topic,34056.30.html  Anyways, I copied the diag_system_activity.php page and change some of the code to display ipmi-sensors. I just did the same with coretemp. Its not on the dashboard but you can access it via the web interface.

                              Remove the .txt and upload it to /usr/local/www and you can access it via http://pfsense/diag_coretemp.php

                              To add it to the Diagnostics tab, add this to your config.xml:

                              
                               <installedpackages>[...]
                              
                              <menu>
                              			<name>Core Temps</name>
                              			<tooltiptext>Core Temperatures</tooltiptext>
                              			Diagnostics
                              			<url>/diag_coretemp.php</url>
                              		</menu>
                              
                              		[...]</installedpackages> 
                              
                              

                              coretemp.jpg
                              coretemp.jpg_thumb
                              diag_coretemp.php.txt

                              1 Reply Last reply Reply Quote 0
                              • stephenw10S
                                stephenw10 Netgate Administrator
                                last edited by

                                @Micro:

                                
                                function get_temp() {
                                $temp_out = "";
                                exec("mbmon -c1 | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d ',' -f 1", $dfout);
                                $temp_out = trim($dfout[0]);
                                	
                                return $temp_out;
                                
                                ```}
                                
                                This works fine in the shell.
                                

                                This doesn't work for me. You can get mbmon to output the data directly like so:

                                
                                [2.0-RC3][root@pfsense.fire.box]/root(26): mbmon -I -c1 -T 1
                                35.0
                                
                                

                                Steve

                                Edit: Yep this is working well for me. Here are the vchanges I've made to /use/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_hwtype() {

                                return;
                                }

                                function get_temp() {
                                $temp_out = "";
                                exec("/usr/local/bin/mbmon -I -c1 -T3", $dfout);
                                $temp_out = trim($dfout[0]);

                                return $temp_out;
                                }

                                Highlighted red parts are changed. Don't forget to change false to true!  ;)

                                1 Reply Last reply Reply Quote 0
                                • M
                                  Micro
                                  last edited by

                                  Ihaaaa !!!!!

                                  You're a god steve !!!
                                  Now it works with mbmon.
                                  Indeed, with the command I built, the result wasn't exactly the same in the shell than with yours.
                                  I thought it was OK but in fact it wasn't and now, with your help, it works fine.

                                  Just a little correction, In your last post edit, you indicate this command line :
                                  exec("/usr/local/bin/mbmon -I -c1 -T3", $dfout);
                                  I don't know if the sensors are HW dependent but on my firebox X700, it seems that this command return the temperature of the chipset (77°C) and not the CPU one (40°C).

                                  For the CPU, use :
                                  exec("/usr/local/bin/mbmon -I -c1 -T1", $dfout);

                                  I tested this by running the mbmon in loop while I unplugged the CPU FAN and the temperature of the first sensor has growed up while the third one staid unchanged.

                                  So in order to sum up for the Firebox X700 users, if you want to have system temperature in your dashboard, follow these steps :
                                  1- first of all, install the mbmon module on your system

                                  Open SSH connection using putty, type 8 to go to the shell and type the following commands :

                                  pkg_add -r mbmon
                                  rehash

                                  Now if you type

                                  mbmon -c1

                                  You should have something like :

                                  Temp.= 38.0, 127.0, 77.0; Rot.=    0, 5000,    0
                                  Vcore = 1.49, 3.38; Volt. = 3.31, 4.95, 11.61,  -3.12, -6.12

                                  This means CPU temp is 38°C, second sensors seems to not be connected, and chipset temp is 77°C.
                                  The CPU FAN speed is 5000 rpm.

                                  2- Change the php files content :

                                  change the has_temp and get_temp functions code

                                  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("/usr/local/bin/mbmon -I -c1 -T1", $dfout);
                                  $temp_out = trim($dfout[[/color]0]);

                                  return $temp_out;
                                  }

                                  The code for these functions is located in the /usr/local/www/includes/functions.inc.php

                                  You can also change the line 240 of the /usr/local/www/widgets/widgets/system_information.widget.php file from

                                  "border: 0px solid white;" size="30" name="tempmeter" id="tempmeter" value="****" />

                                  to

                                  "border: 0px solid white;" size="30" name="tempmeter" id="tempmeter" value="****" />

                                  And that's it, you should now have the CPU temperature displayed in your dashboard of pfsense.

                                  Note: as I'm not very friendly with linux tools like vi, I'm using WinSCP to get files from the pfsense box to my windows PC, change them with windows tools and put them back using WinSCP.
                                  As told asterix, be careful to be in binary mode when transferring files with WinSCP.

                                  Many thanks for steve and all the guys on this forum for their help.

                                  Micro.

                                  The biggest security issue is …. you !!!

                                  HW : Watchguard Firebox x700
                                  CPU : Intel Celeron 1.2GHz
                                  RAM : 256MB

                                  1 Reply Last reply Reply Quote 0
                                  • stephenw10S
                                    stephenw10 Netgate Administrator
                                    last edited by

                                    I too have two sensors that can be seen by mbmon in the X6000. I'm not sure which sensor is the CPU but sensor 3 is the highest so that's what I want to know about.

                                    
                                    [2.0-RC3][root@pfsense.fire.box]/root(1): mbmon -I
                                    
                                    Temp.= 36.0, 13.0, 40.5; Rot.= 5769, 5357, 5818
                                    Vcore = 1.15, 2.26; Volt. = 3.38, 5.05, 12.10, -11.87, -0.62
                                    
                                    

                                    I have to use the -I operator otherwise I get an error message about smb sensors.

                                    If you don't like vi (like me!  ;)) then you can use the ee editor instead which is included in pfSense.

                                    Steve

                                    1 Reply Last reply Reply Quote 0
                                    • CNLiberalC
                                      CNLiberal
                                      last edited by

                                      I can use 'coretemp' and 'mbmon' from the CLI.  Both give a temperature response.  They are both different, but at least there's a number.  I have changed the appropriate widgets php file, but I'm not getting any temperature read out.  I know the changes I made are working, because I can now see the degrees C sign, but no temperature.  This makes me think there's something in the php code for the widget that's incorrect.  Has anyone else seen this?

                                      Jim

                                      pfSense 2.7.2-RELEASE

                                      Dell R210 II
                                      Intel E3-1340 v2
                                      8GB RAM
                                      SSD ZFS Mirror
                                      Intel X520-DA2, RJ45 SFP+ (WAN) and 10Gb SFP+ DAC (LAN)
                                      1 x Cisco 3850 12XS-S (Core Switch)
                                      2 x Cisco 3750X PoE Gig Switch (Access Stack)
                                      3 x Cisco 2802i APs (Mobility Express)

                                      1 Reply Last reply Reply Quote 0
                                      • jimpJ
                                        jimp Rebel Alliance Developer Netgate
                                        last edited by

                                        Now just turn this all into a handy package we can put in the repo :-)

                                        Really just need the amdtemp and coretemp modules for i386 and amd64 and some code to copy them in place. (We can put those on files.pfsense.org, they don't go into the packages repo.) The widget could be a separate file instead of part of the core system info, would coexist better that way.

                                        You also do not need wget, use fetch, it's built in.

                                        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                        Need help fast? Netgate Global Support!

                                        Do not Chat/PM for help!

                                        1 Reply Last reply Reply Quote 0
                                        • S
                                          seh2000
                                          last edited by

                                          @jimp:

                                          Now just turn this all into a handy package we can put in the repo :-)

                                          Really just need the amdtemp and coretemp modules for i386 and amd64 and some code to copy them in place. (We can put those on files.pfsense.org, they don't go into the packages repo.) The widget could be a separate file instead of part of the core system info, would coexist better that way.

                                          You also do not need wget, use fetch, it's built in.

                                          That will be so cool, I am really happy that for now I can see the temp on the dashboard despite I need to reedit after each snapshot, well what I done is  have the edited files on the file server so all I need is just to fire up WINscp to copy after an upgrade.
                                          Steen

                                          1 Reply Last reply Reply Quote 0
                                          • stephenw10S
                                            stephenw10 Netgate Administrator
                                            last edited by

                                            If it's built as a package it will re-install automagically after an update.  ;D
                                            Which would be nice.

                                            Steve

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.