# determine CPU temperature



## Ole (Dec 8, 2008)

Hello!

What there is a unique, a  general method of fetching of statistics on CPU 
temperature in FreeBSD? At "general" method - i mean is available in view of excluding 
vendor-specific healh-agents with their vendors lock-in API.

As i know some way for this: smb(4) (for old PC?), coretemp(4) (this is for 
new and only Intel hardware ?) and ipmi(4) if available, so each machine 
customize for temp statistics throuch individual setup for source data?

And it is necessary to prefer what data if it is some given. For example 2 
commands on host give diffrent result:
(With 'ipmitool')



> % ipmitool sensor |egrep "[0-9]++ Temp"
> CPU 1 Temp       | na         | degrees C  | na    | na        | 74.000    | -128.000  | -48.000   | na        | na
> CPU 2 Temp       | na         | degrees C  | na    | na        | 74.000    | -128.000  | -48.000   | na        | na



<<  i get 74C on my CPU1 and CPU2

(with coretemp(4) i get individual per-core sensor)


> % sysctl -a |egrep -E "cpu\.[0-9]+\.temp"
> dev.cpu.0.temperature: 38
> dev.cpu.1.temperature: 45
> dev.cpu.2.temperature: 42
> dev.cpu.3.temperature: 69



ipmi/coretemp facility is fetching information for CPU from diffrent sensors?

And how much correctly with coretemp(4) to receive the general temperature 
(one number as in Bios) if average(sum(core temperature)) / (num of core) ? 
Thanks in advance!


----------



## sverreh (Dec 8, 2008)

I use this on 7.0:


```
# sysctl hw.acpi.thermal.tz0.temperature
```

I don't know if this is general enough for you, but at least it is not vendor specific. :h


----------



## felix (Dec 8, 2008)

sverreh said:
			
		

> I use this on 7.0:
> 
> 
> ```
> ...



FreeBSD 7.0-RELEASE (GENERIC) #0: Sun Feb 24 19:59:52 UTC 2008
CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz (2992.51-MHz 686-class CPU)
Origin = "GenuineIntel"  Id = 0xf41  Stepping = 1
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,
Features2=0x441d<SSE3,DTES64,MON,DS_CPL,CNXT-ID,xTPR>
Logical CPUs per core: 2


```
# sysctl hw.acpi.thermal.tz0.temperature
sysctl: unknown oid 'hw.acpi.thermal.tz0.temperature'
```


----------



## Ole (Dec 8, 2008)

Unusable for me too:


> [root@ ~]# uname -rp
> 8.0-CURRENT i386
> [root@ ~]# sysctl hw.acpi.thermal.tz0.temperature
> sysctl: unknown oid 'hw.acpi.thermal.tz0.temperature'





> I don't know if this is general enough for you, but at least it is not vendor specific.


- Everything that not require downloads special (!= FreeBSD/kernel/userland) soft.


----------



## softblur (Dec 8, 2008)

What is your processor?  I have an Athlon 64 X2 6000+ myself, and the only thing that seems to work is sysutils/k8temp.  Even so, there is some discussion about how to interpret the offset corrections.


----------



## sverreh (Dec 8, 2008)

felix said:
			
		

> FreeBSD 7.0-RELEASE (GENERIC) #0: Sun Feb 24 19:59:52 UTC 2008
> 
> 
> ```
> ...



So then I'm wrong! :r I thought this was new in 7.0, because I didn't find it on 6.1. But that was another machine.


```
# uname -mrisv
FreeBSD 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24 19:59:52 UTC 2008     root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386 GENERIC
 # sysctl hw.acpi.thermal.tz0.temperature
hw.acpi.thermal.tz0.temperature: 43.0C
 #
```

CPU (From /var/run/dmesg.boot):


```
CPU: Intel(R) Pentium(R) 4 CPU 2.80GHz (2806.37-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0xf29  Stepping = 9
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x4400<CNXT-ID,xTPR>
  Logical CPUs per core: 2
```


----------



## none (Dec 8, 2008)

hail,

I have a pretty old cpu and this works fine:

[xxx@xxx /usr/home/xxx/bin]$ cat tz.sh 
sysctl hw.acpi.thermal.tz0.temperature
[xxx@xxx /usr/home/xxx/bin]$ ./tz.sh 
hw.acpi.thermal.tz0.temperature: 43.5C

[xxx@xxx /usr/home/xxx/bin]$ dmesg | head -12
Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 7.1-PRERELEASE #1: Thu Nov 13 23:54:59 BRT 2008
    root@lamneth:/usr/obj/usr/src/sys/xxx_7-3G
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD Athlon(tm) XP 1700+ (1466.51-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x681  Stepping = 1
  Features=0x383fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE>
  AMD Features=0xc0400800<SYSCALL,MMX+,3DNow!+,3DNow!>
real memory  = 1072562176 (1022 MB)

just on my turion laptop it always said 60Â°, no matter what 
I loaded no special modules though

none


----------



## Ole (Dec 8, 2008)

softblur said:
			
		

> What is your processor?  I have an Athlon 64 X2 6000+ myself, and the only thing that seems to work is sysutils/k8temp.  Even so, there is some discussion about how to interpret the offset corrections.



my home desktop station hw:


> dmesg |head -n24
> Copyright (c) 1992-2008 The FreeBSD Project.
> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
> The Regents of the University of California. All rights reserved.
> ...



hw.acpi.thermal.tz0.temperature - its unknown OIDs for my system but coretemp is usable:


> % kldload coretemp
> % sysctl -a |grep temper
> dev.cpu.0.temperature: 60
> dev.cpu.1.temperature: 60
> ...



As i understand from man acpi_thermal(4) OID hw.acpi.thermal.tz0.temperature produce by some acpi module


> ls /boot/kernel |grep ^acpi
> acpi.ko
> acpi_aiboost.ko
> acpi_asus.ko
> ...



For me all of this acpi_* (particularly acpi_asus) not correct for me (Motherboard is Asus P5N64) no one gets OIDs.

BTW, hw.acpi.thermal.tz%d.temperature - it temperature for CPU? Not motherboard sensor?


----------



## sT4k3 (Dec 9, 2008)

Hi, I have servers on Intel Xeon CPU, but 


> sysctl -a | grep tempe
> hw.acpi.thermal.tz0.temperature: 8.3C


this is wrong, than to take temperature on this cpu ?


----------



## braveduck (Dec 9, 2008)

sysutils/healthd works fine for me


----------



## X-Istence (Dec 12, 2008)

The problem you are seeing with the acpi thermal zones is the fact that FreeBSD may not fully support the ACPI information given to it, especially if the motherboard has only been tested with Windows.

Other reasons for seeing values that never change is because the BIOS is using the ACPI data to control the fans and ACPI is given false information so that the OS does not attempt to modify the fan speeds based upon this data.

The reason some of you may not have the thermal zones is because the motherboard does not export them in ACPI and thus they are not useable.

For most of my motherboards I use mbmon from the ports tree, works like a charm on most of my systems.


----------



## softblur (Dec 12, 2008)

X-Istence, you may be right as far as your comments go.

But some programs, like sysutils/k8temp, read straight from the processor according to documentation from AMD, so the whole issue of ACPI and motherboard is bypassed.  I suppose similar programs exist for Intel processors.  The surprising thing is that the correct interpretation of readings and offset corrections still seems to be troublesome.  At least, with the googling I have done, I have not found any definitive answer.  Like sT4k3 I find that the core temp reported is sometimes below ambient temperature, which simply cannot be the case.

And, FWIW, mbmon does not work on my current system.


----------



## X-Istence (Dec 12, 2008)

I never went as far as to insinuate that ACPI was required for everything. Yes, software exists that reads it directly from the hardware in question bypassing ACPI, which is the only way to get valid data most of the time. I was just pointing out the flaws in ACPI and while it is a standard way to get data from a motherboard for some odd reason not everything is supported everywhere causing problems as a whole.


----------



## Darwin (Mar 2, 2009)

FreeBSD 7.0-RELEASE


```
(21:15)-[root@home /home/Darwin]# kldstat | grep core
13    1 0xc3a88000 3000     coretemp.ko
(21:15)-[root@home /home/Darwin]# 
(21:15)-[root@home /home/Darwin]# sysctl -a | grep temp
(21:15)-[root@home /home/Darwin]#
```


----------



## ale (Mar 2, 2009)

As I don't have an Intel cpu on my desktop, but I have an Asus mb, as an alternative to k8temp:

`# kldload acpi_aiboost`

```
$ sysctl -a | grep aiboost
dev.acpi_aiboost.0.%desc: ASUStek AIBOOSTER
dev.acpi_aiboost.0.%driver: acpi_aiboost
dev.acpi_aiboost.0.%location: handle=\_SB_.PCI0.SBRG.ASOC
dev.acpi_aiboost.0.%pnpinfo: _HID=ATK0110 _UID=16843024
dev.acpi_aiboost.0.%parent: acpi0
dev.acpi_aiboost.0.temp0: 510
dev.acpi_aiboost.0.temp1: 300
dev.acpi_aiboost.0.volt0: 1312
dev.acpi_aiboost.0.volt1: 3328
dev.acpi_aiboost.0.volt2: 4919
dev.acpi_aiboost.0.volt3: 11430
dev.acpi_aiboost.0.fan0: 2960
dev.acpi_aiboost.0.fan1: 0
dev.acpi_aiboost.0.fan2: 0
```
I guess the temperature should be divided by 10.


----------



## trev (Mar 3, 2009)

AMD Phenom 9550 - none of the existing kernel modules or ports utils work, so I wrote my own to interrogate the ITE IT8718F super i/o chip environment controller on the Gigabyte motherboard 


```
root# it8718fd -v
Found an ITE IT8718F (id 0x8718, version 0x05) at special address port 0x2e

System 41C
CPU 37C
Northbridge 85C

CPU 2039 rpm
System 0 rpm
Northbridge 5400 rpm

Vcore    1.06
VDDR     2.00
+3.3     3.23
+5       4.95
+12      11.49
-12      -11.86
-5       -6.85
VSB      0.00
Vbat     3.18
```

It can also be run as a daemon with output via syslog:


```
Mar  3 21:24:22 shadow it8718fd: Temp 41, 37, 85; RPM 2020, 0, 5443; Volts 1.06, 2.00, 3.23, 4.95, 11.49, -11.86, -6.85, 0.00, 3.18
```


----------



## kegf (Mar 3, 2009)

Mbmon - nice motherboard monitor with different access methods ("VIA686  HWM  directly"|"SMBus"|"ISA I/O port").

# mbmon -I -c
Temp.= 31.0, 51.0,  0.0; Rot.= 2678, 3750, 2083
Vcore = 1.36, 3.15; Volt. = 3.26, 5.13, 11.98, -14.59, -7.71


----------



## Mad_Dud (Nov 17, 2009)

I also can't get thermal data on my box.


```
[B]x#[/B] uname -a
FreeBSD --- 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May  1 08:49:13 UTC 2009
     root@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
[B]x#[/B] mbmon
ioctl(smb0:open): No such file or directory
No Hardware Monitor found!!
InitMBInfo: Bad file descriptor
[B]x#[/B] mbmon -d                                                   
ioctl(smb0:open): No such file or irectory                       
SMBus[Intel8XX(ICH/ICH2/ICH3/ICH4/ICH5/ICH6)] found, but No HWM available on it!!
No Hardware Monitor found!!                                                      
InitMBInfo: Bad file descriptor    
[B]x#[/B] sysctl -a hw.acpi.thermal.tz0.temperature                                 
sysctl: unknown oid 'hw.acpi.thermal.tz0.temperature'    
[B]x#[/B] sysctl -a | grep temp
net.inet6.ip6.use_tempaddr: 0
net.inet6.ip6.temppltime: 86400
net.inet6.ip6.tempvltime: 604800
net.inet6.ip6.prefer_tempaddr: 0
[B]x#[/B]  sysctl -a | grep CPU                                                  
hw.model: Intel(R) Pentium(R) 4 CPU 3.00GHz                                                                    
dev.cpu.0.%desc: ACPI CPU                                                                                      
dev.cpu.0.%location: handle=\_PR_.CPU1                                                                         
dev.cpu.1.%desc: ACPI CPU                                                                                      
dev.cpu.1.%location: handle=\_PR_.CPU2                                                                         
[color="Red"]dev.p4tcc.0.%desc: CPU Frequency Thermal Control                                                               
dev.p4tcc.1.%desc: CPU Frequency Thermal Control                                 [/color]                              
[B]x#[/B]  sysctl -a | grep cpu                                                  
kern.threads.virtual_cpu: 2                                                                                    
kern.ccpu: 0                                                                                                   
kern.smp.cpus: 2                                                                                               
kern.smp.maxcpus: 16                                                                                           
debug.cpufreq.verbose: 0                                                                                       
debug.cpufreq.lowest: 0                                                                                        
debug.kdb.stop_cpus: 1                                                                                         
debug.stop_cpus_with_nmi: 1                                                                                    
debug.PMAP1changedcpu: 3698                                                                                    
hw.ncpu: 2                                                                                                     
hw.acpi.cpu.cx_lowest: C1                                                                                      
machdep.cpu_idle_hlt: 1                                                                                        
machdep.hlt_cpus: 0
machdep.hlt_logical_cpus: 0
machdep.logical_cpus_mask: 2
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.CPU1
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 2992
dev.cpu.0.freq_levels: 2992/-1 2618/-1 2244/-1 1870/-1 1496/-1 1122/-1 748/-1
dev.cpu.0.cx_supported: C1/0
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00%
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.CPU2
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/0
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00%
dev.p4tcc.0.%parent: cpu0
dev.p4tcc.1.%parent: cpu1
dev.cpufreq.0.%driver: cpufreq
dev.cpufreq.0.%parent: cpu0
dev.cpufreq.1.%driver: cpufreq
dev.cpufreq.1.%parent: cpu1
```


----------



## CISCOKID (Aug 21, 2011)

When I run the command: `sysctl -a | grep tempe` 
I get the following...


```
dev.cpu.0.temperature: 42
dev.cpu.1.temperature: 41
dev.cpu.2.temperature: 45
dev.cpu.3.temperature: 45
```
Are these values in CELSIUS or FAHRENHEIT? I can't recall the last time I cleaned my cooling fans so I'm wondering if I should.


----------



## wblock@ (Aug 21, 2011)

Celsius.


----------



## xibo (Aug 21, 2011)

45C is fine, but cleaning your computer won't hurt


----------

