Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | Yes |
Requirements | FreeBSD |
Time | 2m |
FreeBSD find CPU (processor) temperature command
You must enable coretemp kernel device driver for Intel based cpu for digital thermal sensor. See below how to load the driver as a module at boot time using /boot/loader.conf file on a FreeBSD to get CPU temperature. The coretemp driver reports each CPU core’s temperature through a sysctl command.
Monitoring the CPU temperature of your FreeBSD Unix box
Load the FreeBSD kernel driver/module using the kldload command:
sudo kldload -v coretemp
Here is what we see:
Loaded coretemp, id=15
What about AMD cpus?
You need to use the amdtemp device driver for AMD processor on-die digital thermal sensor. We can load it as follows:
sudo kldload -v amdtemp
Now that we installed modules let us try to find CPU temp.
How to determine CPU temperature on FreeBSD
Type the following command to see cpu temperature in FreeBSD operating system:
$ sysctl -a | grep temperature
OR
$ sysctl dev.cpu | grep temperature
Fig.01: Determine CPU temperature on FreeBSD
How to load coretemp or amdtemp driver at boot time automatically
For Intel based cpu you need to load and use coretemp driver. To load the driver as a module at boot time, append the following line in loader.conf(5):
# vi /boot/loader.conf
Append the following for Intel CPUs:
coretemp_load="YES"
Add the following if you are using AMD CPUs:
amdtemp_load="YES"
Save and close the file. To load the driver without rebooting the box, enter:
# kldload coretemp
And for AMD CPUs:
# kldload amdtemp
Once loaded you can verify it with dmesg command
# dmesg | tail -10
Sample outputs:
igb0: link state changed to UP arp: 192.168.2.254 moved from 20:5c:24:70:00:f8 to 00:08:a2:0a:ba:b8 on igb0 coretemp0: <CPU On-Die Thermal Sensors> on cpu0 coretemp1: <CPU On-Die Thermal Sensors> on cpu1 coretemp2: <CPU On-Die Thermal Sensors> on cpu2 coretemp3: <CPU On-Die Thermal Sensors> on cpu3 coretemp4: <CPU On-Die Thermal Sensors> on cpu4 coretemp5: <CPU On-Die Thermal Sensors> on cpu5 coretemp6: <CPU On-Die Thermal Sensors> on cpu6 coretemp7: <CPU On-Die Thermal Sensors> on cpu7
Now to determine your CPU temperature on FreeBSD, type:
# sysctl -a | grep -i temperature
Sample output from Intel Xeon E3-1285L v4 CPU:
hw.acpi.thermal.tz1.temperature: 29.9C
hw.acpi.thermal.tz0.temperature: 27.9C
dev.cpu.7.temperature: 41.0C
dev.cpu.6.temperature: 41.0C
dev.cpu.5.temperature: 40.0C
dev.cpu.4.temperature: 40.0C
dev.cpu.3.temperature: 41.0C
dev.cpu.2.temperature: 41.0C
dev.cpu.1.temperature: 40.0C
dev.cpu.0.temperature: 40.0C
A note about ipmitool
To see detailed sensor information use ipmitool (Intelligent Platform Management Interface) command as follows on your FreeBSD based server:
# ipmitool sensor
Sample outputs:
ATX+5VSB | 5.070 | Volts | ok | 4.230 | 4.710 | na | na | 5.550 | 5.610 +3VSB | 3.500 | Volts | ok | 2.780 | 2.820 | na | na | 3.660 | 3.680 Vcore | 0.830 | Volts | ok | 0.540 | 0.560 | 0.600 | 1.490 | 1.560 | 1.640 VCCM | 1.350 | Volts | ok | 1.090 | 1.120 | na | na | 1.720 | 1.750 +1.1 | 1.090 | Volts | ok | 0.850 | 0.890 | 0.940 | 1.150 | 1.210 | 1.270 +1.0 | 1.020 | Volts | ok | 0.850 | 0.890 | 0.940 | 1.150 | 1.210 | 1.270 BAT | 3.200 | Volts | ok | 2.380 | 2.500 | na | na | 3.580 | 3.680 +3V | 3.300 | Volts | ok | 2.780 | 2.820 | na | na | 3.660 | 3.680 +5V | 5.010 | Volts | ok | 4.230 | 4.710 | na | na | 5.550 | 5.610 +12V | 12.200 | Volts | ok | 10.100 | 10.300 | na | na | 13.300 | 13.400 CPU_FAN1 | na | RPM | na | na | na | 100.000 | na | na | na REAR_FAN1 | na | RPM | na | na | na | 100.000 | na | na | na FRNT_FAN1 | na | RPM | na | na | na | 100.000 | na | na | na FRNT_FAN2 | na | RPM | na | na | na | 100.000 | na | na | na REAR_FAN2 | 1200.000 | RPM | ok | na | na | 100.000 | na | na | na CPU_FAN2 | na | RPM | na | na | na | 100.000 | na | na | na MB Temperature | 55.000 | degrees C | ok | na | na | na | 80.000 | na | na CPU Temperature | 52.000 | degrees C | ok | na | na | na | 80.000 | 85.000 | 90.00
Reading out both CPU and acpi thermal temperature
Again use the grep command/egrep command:
sudo sysctl -a | grep -E 'acpi.thermal.*temperature|dev.cpu.*temperature'
Outputs from my Intel NUC with Intel Core i7-8650U CPU:
hw.acpi.thermal.tz1.temperature: 29.9C hw.acpi.thermal.tz0.temperature: 27.9C dev.cpu.7.temperature: 39.0C dev.cpu.6.temperature: 39.0C dev.cpu.5.temperature: 40.0C dev.cpu.4.temperature: 40.0C dev.cpu.3.temperature: 40.0C dev.cpu.2.temperature: 40.0C dev.cpu.1.temperature: 38.0C dev.cpu.0.temperature: 38.0C
See “FreeBSD CPU Information Command” for more info.
FreeBSD only command line tool to display CPU temp and battery details
First install the hwstat as following using the pkg command:
$ sudo pkg install hwstat
Confirm installation when prompted by system:
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
hwstat: 0.5.1
Number of packages to be installed: 1
7 KiB to be downloaded.
Proceed with this action? [y/N]: y
[1/1] Fetching hwstat-0.5.1.txz: 100% 7 KiB 7.3kB/s 00:01
Checking integrity... done (0 conflicting)
[1/1] Installing hwstat-0.5.1...
[1/1] Extracting hwstat-0.5.1: 100%
Now type:
hwstat
And we see details:
Current Unit [Coretemp] CPU0: 38.0 C CPU1: 38.0 C CPU2: 40.0 C CPU3: 40.0 C CPU4: 39.0 C CPU5: 39.0 C CPU6: 39.0 C CPU7: 39.0 C [ACPI Thermal] tz0: 27.9 C [ACPI Thermal] tz1: 29.9 C
Displaying temperature in Fahrenheit
hwstat -f
Showing the temperature in Kelvins
hwstat -k
See “FreeBSD Laptop Find Out Battery Life Status Command” for getting info about laptop battry.
Conclusion
You just learned how to check cpu temperature on a FreeBSD based system. For more info see coretemp docs here/here and read the man pages by typing the following man command:
$ man 4 coretemp # <- for INTEL cpus
$ man 4 amdtemp # <- for AMD cpus
$ man 8 sysctl
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 2 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
AMD
# kldload amdtemp
# sysctl -a | grep temperature
Whoa:
Ron, thank you sir! i have added amdtemp into my loader.conf thanks to you!