How can I monitor CPU temperature and fan speed?

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?
 
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.
 
Younger intel processors, supported by coretemp(), will have their temperature noted in sysctl
$ sysctl dev.cpu | grep temp
Code:
dev.cpu.0.temperature: 36,0C
dev.cpu.1.temperature: 37,0C
 
my kernel config always have the following lines:

Code:
# 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
 
set this line on /boot/loader.conf
Code:
coretemp_load="YES"
reboot and sysctl dev.cpu | grep temp show you something like this:
Code:
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 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)
 
OP
olav
Coretemp works great! Ive tried mbmon too, but it reports a different temperature? And the fan speed, is it rotations per hour?
 
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:
Code:
#!/bin/sh

cores=0

until [ $cores -eq 4 ]
do
	echo Core \#$cores: `sysctl -n dev.cpu.$cores.temperature`
	cores=`expr $cores + 1`
done
 
Code:
#!/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?
 
Code:
#!/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`
 
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

---

Code:
sysctl -a | grep temp

and you will get for example:

Code:
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:

Code:
sysctl dev.cpu | grep temp
for
Code:
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:

Code:
sysctl dev.cpu.0.temperature
 
Top