• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
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.4k
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.
  • S
    stephenw10 Netgate Administrator
    last edited by Aug 9, 2011, 12:00 AM

    Yes I'm seeing that too. Hard to see why it's happening from the code.  :-\

    Steve

    1 Reply Last reply Reply Quote 0
    • S
      seh2000
      last edited by Aug 9, 2011, 12:22 AM

      @stephenw10:

      Yes I'm seeing that too. Hard to see why it's happening from the code.  :-\

      Steve

      Hi Steve - thanks as then I know I did not do something wrong!  ;D
      Steen

      1 Reply Last reply Reply Quote 0
      • C
        Cino
        last edited by Aug 9, 2011, 12:29 AM

        @jimp:

        I wouldn't average them, if one core is running hot you'd probably want to know.

        true…. you would think they would be around the same temp since they are in the same package but i dont know much about the dual/quad core processors.

        1 Reply Last reply Reply Quote 0
        • S
          seh2000
          last edited by Aug 9, 2011, 12:29 AM

          @Cino:

          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> 
          
          

          Hi Cino,
          Just followed your great writeup and it worked!
          As attached screenshot shows.
          Thanks!
          Steen

          ![pfSense Diag Coretemp sh.jpg](/public/imported_attachments/1/pfSense Diag Coretemp sh.jpg)
          ![pfSense Diag Coretemp sh.jpg_thumb](/public/imported_attachments/1/pfSense Diag Coretemp sh.jpg_thumb)

          1 Reply Last reply Reply Quote 0
          • C
            Cino
            last edited by Aug 9, 2011, 12:34 AM

            @seh2000 good to hear!! i give all the credit to Scott Ullrich for making the original page.. I just changed some of the code for our needs :-)

            1 Reply Last reply Reply Quote 0
            • S
              seh2000
              last edited by Aug 9, 2011, 1:20 AM

              @stephenw10:

              Yes I'm seeing that too. Hard to see why it's happening from the code.  :-\

              Steve

              Steve,
              I am not a programmer, but if I replace the "C" with another symbol or take the "C" away then at the next update it is replaced with a "C" I believe this is from the command sysctl dev.cpu.0.temperature as the return is nn.nC so the degree symbol and the C added to the system_information.widget.php is overwritten, but this is only seen when other symbol in front or after the "C" is added or another letter e.g. "K". If the "C" is ommitted the it is not see when the dashboard is loaded, but appears at the 1st update.
              Steen

              1 Reply Last reply Reply Quote 0
              • A
                ariyako
                last edited by Aug 9, 2011, 3:05 AM Aug 9, 2011, 3:00 AM

                just in case you got HTTP ERROR 403 while wget from ptt.4mg.com/pfSense

                then try this links

                if you are on i386
                http://www.ariyako.org/pfsense/coretemp32.zip

                if you are on AMD64
                http://www.ariyako.org/pfsense/coretemp64.zip

                1 Reply Last reply Reply Quote 0
                • J
                  jimp Rebel Alliance Developer Netgate
                  last edited by Aug 9, 2011, 3:08 AM

                  Even better:
                  http://files.pfsense.org/jimp/tempmon/

                  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
                  • A
                    ariyako
                    last edited by Aug 9, 2011, 3:23 AM

                    @jimp:

                    Even better:
                    http://files.pfsense.org/jimp/tempmon/

                    WIN  ;D  :D

                    1 Reply Last reply Reply Quote 0
                    • S
                      stephenw10 Netgate Administrator
                      last edited by Aug 9, 2011, 9:53 AM

                      @seh2000:

                      I am not a programmer, but if I replace the "C" with another symbol or take the "C" away then at the next update it is replaced with a "C" I believe this is from the command sysctl dev.cpu.0.temperature as the return is nn.nC so the degree symbol and the C added to the system_information.widget.php is overwritten

                      It exhibits the same behaviour for me and I'm using mbmon to get the temperature which returns only the temperature, nn.n.

                      Steve

                      1 Reply Last reply Reply Quote 0
                      • M
                        Metu69salemi
                        last edited by Aug 9, 2011, 10:09 AM

                        Waiting to someone package this or make a widget.

                        1 Reply Last reply Reply Quote 0
                        • S
                          seh2000
                          last edited by Aug 9, 2011, 11:11 AM

                          It exhibits the same behaviour for me and I'm using mbmon to get the temperature which returns only the temperature, nn.n.

                          Steve

                          Hi Steve,
                          Tried to get mbmon to work on my box, but cannot as I would have liked to have the fan RPMs, but core temp will do for now and at least now we know why the ' ° ' goes away (overwritten).
                          Cheers Steen

                          1 Reply Last reply Reply Quote 0
                          • S
                            stephenw10 Netgate Administrator
                            last edited by Aug 9, 2011, 11:46 AM

                            The coretemp sensor is far more accurate. I would use that if my hardware supported it.
                            I was pointing out that the ° symbol disappears even though mbmon does not return a 'C' character.
                            I would guess it's being snipped by some other part of the script.

                            Steve

                            1 Reply Last reply Reply Quote 0
                            • S
                              seh2000
                              last edited by Aug 9, 2011, 11:58 AM

                              @stephenw10:

                              The coretemp sensor is far more accurate. I would use that if my hardware supported it.
                              I was pointing out that the ° symbol disappears even though mbmon does not return a 'C' character.
                              I would guess it's being snipped by some other part of the script.

                              Steve

                              Tx for the feedback I will keep using coretemp.
                              When I replaced the 'C' with Q, 6, z then each time at the first updated they were replaced with the 'C', but why under mbmon in mbmon does not return a 'C' character - no idea.
                              Maybe one could strip the 'C' by only allow NN.n in the field and have ° C hardcoded somehow. Well at least I can see the temp right now from one care this been a wish for a long time! Thanks to all here for making that happen!
                              Cheers Steen

                              1 Reply Last reply Reply Quote 0
                              • S
                                stephenw10 Netgate Administrator
                                last edited by Aug 9, 2011, 12:32 PM Aug 9, 2011, 12:24 PM

                                Speculating….
                                There are two functions. One that draws the table and all the static data and fills in the dynamic data, system_information.widget.php. Another function updates the dynamic data and it's that function that needs updating to include a °.
                                ...End speculation.

                                Steve

                                Edit: Yes. In /usr/local/www/javascript/index/ajax.js
                                Add a ° to the updateTemp function like this:

                                function updateTemp(x) {
                                if($("tempmeter")) {
                                $("tempmeter").value = x + '°C';
                                $("tempwidtha").style.width = x + 'px';
                                $("tempwidthb").style.width = (100 - x) + 'px';
                                }

                                1 Reply Last reply Reply Quote 0
                                • S
                                  seh2000
                                  last edited by Aug 9, 2011, 12:47 PM

                                  @stephenw10:

                                  Speculating….
                                  There are two functions. One that draws the table and all the static data and fills in the dynamic data, system_information.widget.php. Another function updates the dynamic data and it's that function that needs updating to include a °.
                                  ...End speculation.

                                  Steve

                                  Edit: Yes. In /usr/local/www/javascript/index/ajax.js
                                  Add a ° to the updateTemp function like this:

                                  function updateTemp(x) {
                                  if($("tempmeter")) {
                                  $("tempmeter").value = x + '°C';
                                  $("tempwidtha").style.width = x + 'px';
                                  $("tempwidthb").style.width = (100 - x) + 'px';
                                  }

                                  YIHUUUUUU!  ;D  :D  :)
                                  Steve you are the man!
                                  Works like a dream now.
                                  Now I will try to work on getting all four cores to be displayed.
                                  Cheers Steen

                                  1 Reply Last reply Reply Quote 0
                                  • C
                                    CNLiberal
                                    last edited by Aug 9, 2011, 1:00 PM

                                    @stephenw10:

                                    Speculating….
                                    There are two functions. One that draws the table and all the static data and fills in the dynamic data, system_information.widget.php. Another function updates the dynamic data and it's that function that needs updating to include a °.
                                    ...End speculation.

                                    Steve

                                    Edit: Yes. In /usr/local/www/javascript/index/ajax.js
                                    Add a ° to the updateTemp function like this:

                                    function updateTemp(x) {
                                    if($("tempmeter")) {
                                    $("tempmeter").value = x + '°C';
                                    $("tempwidtha").style.width = x + 'px';
                                    $("tempwidthb").style.width = (100 - x) + 'px';
                                    }

                                    When I make the above change, I get this:

                                    °C

                                    That's after the page refreshes.  This is the code I'm putting in:

                                    
                                    function updateTemp(x) {
                                    	if($("tempmeter")) {
                                    		$("tempmeter").value = x + '°C';
                                    		$("tempwidtha").style.width = x + 'px';
                                    		$("tempwidthb").style.width = (100 - x) + 'px';
                                    	}
                                    }
                                    
                                    

                                    I tried, instead, adding the #176; or whatever the ASCII code was, and it just showed me the ASCII code.  What did I do wrong?  Thanks!

                                    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
                                    • S
                                      seh2000
                                      last edited by Aug 9, 2011, 1:25 PM

                                      I just fund the ° symbol in my word processor symbol library then copied it to:

                                      /usr/local/www/javascript/index/ajax.js

                                      function updateTemp(x) {
                                      if($("tempmeter")) {
                                      $("tempmeter").value = x + '°C';
                                      $("tempwidtha").style.width = x + 'px';
                                      $("tempwidthb").style.width = (100 - x) + 'px';

                                      /usr/local/www/widgets/widgets/system_information.widget.php

                                      Core 1 Temperature

                                      ![](./themes/<?= $g[)/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" />![](./themes/<?= $g[)/images/misc/bar_blue.gif" height="15" name="tempwidtha" id="tempwidtha" width="" border="0" align="middle" alt="red bar" />![](./themes/<?= $g[)/images/misc/bar_gray.gif" height="15" name="tempwidthb" id="tempwidthb" width="" border="0" align="middle" alt="gray bar" />![](./themes/<?= $g[)/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" />

                                      Used first the ASCI code, but then the symbol, also I seen some places this around " and other ' around - I use ' hope this helps.
                                      The reason for Core1 instead of CPU is I play with having all four cores displayed.

                                      Steen

                                      1 Reply Last reply Reply Quote 0
                                      • C
                                        CNLiberal
                                        last edited by Aug 9, 2011, 1:47 PM

                                        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

                                        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
                                        • J
                                          jimp Rebel Alliance Developer Netgate
                                          last edited by Aug 9, 2011, 1:57 PM

                                          You should really use °, don't hardcode such a symbol directly in html/js

                                          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
                                          78 out of 140
                                          • First post
                                            78/140
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.