# How can I monitor CPU temperature and fan speed?



## olav (May 8, 2010)

I've tried to google for this, but I've only found half answers, and theyre also often very different when it comes to what you should install from ports.

So I need some help, what is the recommended hardware monitoring software to install? How do I do it? And how do I use it?


----------



## sverreh (May 8, 2010)

Try mbmon:

/usr/ports/sysutils/mbmon

Works nicely for me.


----------



## paean (May 8, 2010)

I use conky to monitor temps, fan speed, disc and net usage. There are plenty of nicely prepared scripts available. A few people have shared theirs here on the forums.


----------



## OH (May 8, 2010)

Younger intel processors, supported by coretemp(), will have their temperature noted in sysctl
`$ sysctl dev.cpu | grep temp`

```
dev.cpu.0.temperature: 36,0C
dev.cpu.1.temperature: 37,0C
```


----------



## User23 (May 10, 2010)

my kernel config always have the following lines:


```
# CPU frequency control
device          [url=http://www.FreeBSD.org/cgi/man.cgi?query=cpufreq&apropos=0&sektion=0&manpath=FreeBSD+8.0-RELEASE&format=html]cpufreq[/URL] 
device          [url=http://www.FreeBSD.org/cgi/man.cgi?query=amdtemp&apropos=0&sektion=0&manpath=FreeBSD+8.0-RELEASE&format=html]amdtemp[/URL]  # for AMD CPU
#device         [url=http://www.FreeBSD.org/cgi/man.cgi?query=coretemp&apropos=0&sektion=0&manpath=FreeBSD+8.0-RELEASE&format=html]coretemp[/URL]  # for Intel CPU
```


----------



## sk8harddiefast (May 10, 2010)

set this line on /boot/loader.conf

```
coretemp_load="YES"
```
reboot and sysctl dev.cpu | grep temp show you something like this:

```
dev.cpu.0.temperature: 59.0C
dev.cpu.1.temperature: 57.0C
dev.cpu.2.temperature: 55.0C
dev.cpu.3.temperature: 56.0C
```
Now i am trying to exec somehow sysctl dev.cpu | grep temp on conky
there is also xmbmon where is the graphical mbmon if you like it


----------



## DutchDaemon (May 10, 2010)

Don't grep sysctl output, just run something like sysctl -n dev.cpu.0.temperature.


----------



## sk8harddiefast (May 11, 2010)

DutchDaemon solutions sounds much better 
There Is difference of grep and -n on sysctl? (except the output of  "sysctl -n dev.cpu.0.temperature" shows the temp of the first core and "sysctl dev.cpu | grep" shows temp of all cores)


----------



## olav (May 11, 2010)

Coretemp works great! Ive tried mbmon too, but it reports a different temperature? And the fan speed, is it rotations per hour?


----------



## Beastie (May 11, 2010)

sk8harddiefast said:
			
		

> There Is difference of grep and -n on sysctl? (except the output of  "sysctl -n dev.cpu.0.temperature" shows the temp of the first core and "sysctl dev.cpu | grep" shows temp of all cores)


You're on FreeBSD, and the documentation is at your fingertips!

*-n* shows the variable without the names. You get the difference you mentioned because DutchDaemon specified core *0*. You could just as well use `% sysctl -n dev.cpu` or better, call `% sysctl -n dev.cpu.n.temperature` four times one for each core. Like this:

```
#!/bin/sh

cores=0

until [ $cores -eq 4 ]
do
	echo Core \#$cores: `sysctl -n dev.cpu.$cores.temperature`
	cores=`expr $cores + 1`
done
```


----------



## sk8harddiefast (May 11, 2010)

```
#!/bin/sh

cores=0

until [ $cores -eq 4 ]
do
	echo Core \#$cores: `sysctl -n dev.cpu.$cores.temperature`
	cores=`expr $cores + 1`
done
```

if i exec this script on conky i will get core temp?


----------



## Beastie (May 12, 2010)

I guess so...

```
${color #ff0000}${execi 30 coretemp.sh}
```


----------



## sk8harddiefast (May 12, 2010)

worked find but i have a little problem.Temp shows vertical but i have horizontal conky.Any ideas?


----------



## Beastie (May 12, 2010)

```
#!/bin/sh
echo `sysctl -n dev.cpu.0.temperature`/`sysctl -n dev.cpu.1.temperature`/`sysctl -n dev.cpu.2.temperature`/`sysctl -n dev.cpu.3.temperature`
```


----------



## sk8harddiefast (May 12, 2010)

ok!worked 
Thanks!!!Now my conky is more complete


----------



## klabacita (Sep 10, 2010)

Hi.

Guys, where I can see all the CPU's that coretemp support or how do I know?
Xeon is on them right?

Thanks!!!


----------



## User23 (Sep 10, 2010)

from the coretemp man page:

DESCRIPTION
     The coretemp driver provides support for the on-die digital thermal sen-
     sor present in Intel Core and newer CPUs

---


```
sysctl -a | grep temp
```

and you will get for example:


```
net.inet6.ip6.use_tempaddr: 0
net.inet6.ip6.temppltime: 86400
net.inet6.ip6.tempvltime: 604800
net.inet6.ip6.prefer_tempaddr: 0
dev.cpu.0.temperature: 33.0C
dev.cpu.1.temperature: 32.0C
dev.cpu.2.temperature: 28.0C
dev.cpu.3.temperature: 32.0C
dev.coretemp.0.%desc: CPU On-Die Thermal Sensors
dev.coretemp.0.%driver: coretemp
dev.coretemp.0.%parent: cpu0
dev.coretemp.1.%desc: CPU On-Die Thermal Sensors
dev.coretemp.1.%driver: coretemp
dev.coretemp.1.%parent: cpu1
dev.coretemp.2.%desc: CPU On-Die Thermal Sensors
dev.coretemp.2.%driver: coretemp
dev.coretemp.2.%parent: cpu2
dev.coretemp.3.%desc: CPU On-Die Thermal Sensors
dev.coretemp.3.%driver: coretemp
dev.coretemp.3.%parent: cpu3
```

now you know the variable you are able to ask with sysctl directly for it, without wasting cpu time while asking for all of the variables 

example:


```
sysctl dev.cpu | grep temp
```
for

```
dev.cpu.0.temperature: 32.0C
dev.cpu.1.temperature: 31.0C
dev.cpu.2.temperature: 28.0C
dev.cpu.3.temperature: 31.0C
```

or directly:


```
sysctl dev.cpu.0.temperature
```


----------



## klabacita (Sep 10, 2010)

This is just for reference, I see that my current Xeon is able to give this info.

 Thanks User23.


----------

