如何使用Linux监视和显示CPU温度?

评论

很高兴看到如此简短,快速而精确的问题得到了如此多的答复:-)

#1 楼

正如其他人指出的那样,您需要lm-sensors软件包。我想我应该提到的是,除了安装软件包外,还应该运行sensors-detect命令来标识需要加载的内核模块。

如果尚未执行此操作,请手动运行一次,然后检查它是否检测到计算机上的任何传感器。

$ sudo sensors-detect 
# sensors-detect revision 5249 (2008-05-11 22:56:25 +0200)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

We can start with probing for (PCI) I2C or SMBus adapters.
Do you want to probe now? (YES/no): 
Probing for PCI bus adapters...
Use driver `i2c-i801' for device 0000:00:1f.3: Intel 82801G ICH7

We will now try to load each adapter module in turn.
Module `i2c-i801' already loaded.
If you have undetectable or unsupported I2C/SMBus adapters, you can have
them scanned by manually loading the modules before running this script.

We are now going to do the I2C/SMBus adapter probings. Some chips may
be double detected; we choose the one with the highest confidence
value in that case.
If you found that the adapter hung after probing a certain address,
you can specify that address to remain unprobed.

Next adapter: SMBus I801 adapter at 10c0 (i2c-0)
Do you want to scan it? (YES/no/selectively): 
Client found at address 0x50
Probing for `Analog Devices ADM1033'...                     No
Probing for `Analog Devices ADM1034'...                     No
Probing for `SPD EEPROM'...                                 Yes
    (confidence 8, not a hardware monitoring chip)
Probing for `EDID EEPROM'...                                No
Client found at address 0x52
Probing for `Analog Devices ADM1033'...                     No
Probing for `Analog Devices ADM1034'...                     No
Probing for `SPD EEPROM'...                                 Yes
    (confidence 8, not a hardware monitoring chip)
Probing for `EDID EEPROM'...                                No

Some chips are also accessible through the ISA I/O ports. We have to
write to arbitrary I/O ports to probe them. This is usually safe though.
Yes, you do have ISA I/O ports even if you do not have any ISA slots!
Do you want to scan the ISA I/O ports? (YES/no): 
Probing for `National Semiconductor LM78' at 0x290...       No
Probing for `National Semiconductor LM78-J' at 0x290...     No
Probing for `National Semiconductor LM79' at 0x290...       No
Probing for `Winbond W83781D' at 0x290...                   No
Probing for `Winbond W83782D' at 0x290...                   No
Probing for `IPMI BMC KCS' at 0xca0...                      No
Probing for `IPMI BMC SMIC' at 0xca8...                     No

Some Super I/O chips may also contain sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): 
Probing for Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor'...                   No
Trying family `SMSC'...                                     Yes
Found unknown chip with ID 0x2803
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor'...                   No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Fintek'...                       No
Trying family `ITE'...                                      No

Some south bridges, CPUs or memory controllers may also contain
embedded sensors. Do you want to scan for them? (YES/no): 
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD K10 thermal sensors...                                  No
Intel Core family thermal sensor...                         Success!
    (driver `coretemp')
Intel AMB FB-DIMM thermal sensor...                         No

Now follows a summary of the probes I have just done.
Just press ENTER to continue: 

Driver `coretemp' (should be inserted):
  Detects correctly:
  * Chip `Intel Core family thermal sensor' (confidence: 9)

I will now generate the commands needed to load the required modules.
Just press ENTER to continue: 

To load everything that is needed, add this to /etc/modules:

#----cut here----
# Chip drivers
coretemp
#----cut here----

Do you want to add these lines automatically? (yes/NO)


如果幸运的话,您的笔记本电脑将支持一系列传感器。如果没有,您仍然可以找到适用于CPU的一组基本传感器:

$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:       +40.5°C  (crit = +105.0°C)                  

coretemp-isa-0000
Adapter: ISA adapter
Core 0:      +35.0°C  (crit = +100.0°C)                  

coretemp-isa-0001
Adapter: ISA adapter
Core 1:      +40.0°C  (crit = +100.0°C)                  


评论


如果要在屏幕上显示,我喜欢使用gkrellm,它使用lm传感器进行检测。

–颜色
09年8月19日在7:46

如果要在屏幕上显示它,并且不想使用gkrellm,则也可以使用conky。

–极客
09年12月2日在7:31

如果您使用的是redhat,则您的软件包可能称为lm_sensors(下划线而不是常规的破折号)

–msb
2013年9月20日16:57

在Arch上也是一样,它是lm_sensors。

–bfontaine
2014年7月31日12:08

只是想补充一下,在第一次进行传感器检测之后,我总是不得不重新启动。

–Chuck Claunch
15年4月22日在20:41

#2 楼

使用“传感器”(来自lm-sensors)和“监视”(来自procps pkg),您可以通过以下命令在命令行上实时监视传感器数据:

watch -n 1 -d sensors


这将每1秒显示一次传感器并突出显示与前一秒的差异。

Every 1.0s: /usr/bin/sensors

...
temp1:       +55C  (high =   +50C, hyst =   +45C)   sensor = thermistor   ALARM
temp2:     +35.0C  (high =   +80C, hyst =   +75C)   sensor = thermistor
temp3:     +35.0C  (high =   +80C, hyst =   +75C)   sensor = thermistor


评论


为什么不通过华氏语法?

–雅各布·扬·图恩斯特拉(Jacob Jan Tuinstra)
13年1月26日在22:58

容易,在上面的传感器命令中添加“ -f”选项

– johnnyB
13年1月29日在4:17

值得一提的是,您需要安装lm-sensors软件包才能正常工作。

–威廉·埃弗里特(William Everett)
2014年9月29日下午16:19

#3 楼

lm-sensors


lm-sensors是用于Linux的硬件健康状况监视程序包。它
允许您从
温度,电压和风扇速度
传感器访问信息。它适用于大多数更新的
系统。
该软件包包含帮助您
从lm-sensors设置和读取数据的程序。


要安装,请使用:

# sudo apt-get install lm-sensors sensors-applet


要使用:

# sensors-detect
...
# sensors
V1.5:      +2.467 V  (min =  +1.42 V, max =  +1.58 V)   ALARM
VCore:     +1.479 V  (min =  +1.48 V, max =  +1.63 V)   ALARM
V3.3:      +3.373 V  (min =  +3.13 V, max =  +3.47 V)
V5:       +5.000 V  (min =  +4.74 V, max =  +5.26 V)
V12:      +11.734 V  (min = +11.38 V, max = +12.62 V)
CPU_Fan:   2299 RPM  (min = 4000 RPM)                     ALARM
fan2:         0 RPM  (min =    0 RPM)
fan3:      1057 RPM  (min =    0 RPM)
fan4:         0 RPM  (min =    0 RPM)
CPU:      +41.50°C  (low  =   +10°C, high =   +50°C)
Board:    +35.25°C  (low  =   +10°C, high =   +35°C)
Remote:   +35.50°C  (low  =   +10°C, high =   +35°C)     ALARM
CPU_PWM:   144
Fan2_PWM:  112
Fan3_PWM:  112
vid:      +1.550 V  (VRM Version 9.0)


或将小程序添加到任务栏。




您还可以尝试computertemp小程序。

Ubuntu软件包

首页


计算机温度监视器是用于GNOME桌面的小程序

在屏幕上显示
计算机CPU和磁盘的温度。

它还允许您将温度
记录到文件中。您可以将警报设置为
达到温度时通知您
。可以在面板上添加多个监视器
,以监视不同的传感器。它的外观设计为
CPU Frequency Gnome applet,因此它们在面板上彼此匹配。


要安装,请使用:

sudo apt-get install computertemp


,然后添加到任务栏



#4 楼

我有一台运行Fedora / Red Hat Linux的Dell服务器(Poweredge R420)。我安装了lm_sensors,但是sensors给了我一条消息,指出未加载内核驱动程序。我使用sensor-detect找出了我需要的传感器,结果发现我需要IPMI。

Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `ipmisensors':
  * ISA bus, address 0xca8
    Chip `IPMI BMC KCS' (confidence: 8)

Warning: the required module ipmisensors is not currently installed
on your system. If it is built into the kernel then it's OK.
Otherwise, check http://www.lm-sensors.org/wiki/Devices for
driver availability.


我检查了页面,建议我使用ipmitool。我安装了它,但是仍然无法使用:

$ ipmitool sensor
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
Get Device ID command failed
Unable to open SDR for reading


经过更多研究,我发现了此页面:
http:// osdir。 com / ml / hardware.ipmitool.devel / 2008-02 / msg00012.html

他们的脚本ipmimod.sh为我开箱即用:

#!/bin/bash

#IPMI kernel module installer for Redhat-style machines
#dranch-3r7Miqu9kMnR7s880joybQ@xxxxxxxxxxxxxxxx

#07/26/06 - use absolute paths for modprobe
#05/01/06 - orig version

/sbin/modprobe ipmi_devintf

maj=`cat /proc/devices | awk '/ipmidev/{print }'`
echo $maj
if [ -c /dev/ipmi0 ]
then
   rm -f /dev/ipmi0
   /bin/mknod /dev/ipmi0 c $maj 0
else
   /bin/mknod /dev/ipmi0 c $maj 0
fi

IPMI_DRIVERS="ipmi_si ipmi_si_drv ipmi_kcs_drv"
for driver in $IPMI_DRIVERS; do
  find /lib/modules/`uname -r`/kernel/drivers/char/ipmi | grep $driver > /dev/null
  RETURN_VALUE=$?
  if [ $RETURN_VALUE -eq 0 ] ; then
    #Here are specific memory locations for Supermicro AOC-type IPMI cards
    /sbin/modprobe $driver type=kcs ports=0xca8 regspacings=4
    break
  fi
done


运行该命令之后,我终于可以看到CPU温度:

$ ipmitool sensor | grep Temp
Inlet Temp       | 24.000     | degrees C  | ok    | na        | -7.000    | 3.000     | 42.000    | 47.000    | na
Temp             | na         | degrees C  | na    | na        | 3.000     | 8.000     | 77.000    | 83.000    | na
Temp             | na         | degrees C  | na    | na        | 3.000     | 8.000     | 77.000    | 83.000    | na


我希望这对那些使用Dell服务器遇到困难的人有所帮助得到温度。

#5 楼

Linux允许您访问温度信息传感器。它适用于RH6.2x64。

该驱动程序包含使用lm传感器的读取支持:

type

modprobe coretemp
sensors


#6 楼

我发现了其他带有gui的软件来监视温度。
软件的名称是:Psensor:https://wpitchoune.net/psensor/

并查看来自Internet的文章:https: //www.tecmint.com/psensor-monitors-hardware-temperature-in-linux/

要在Ubuntu / Mint上安装,请在您的终端上运行以下命令:

sudo apt install psensor


要运行该应用程序,只需运行以下命令:

sudo psensor


谢谢。

评论


要配置传感器,请运行此命令并为所有问题键入yes:sudo sensor-detect

– Wellington1993
17年3月3日在4:42

#7 楼

ACPI

值得一提的是acpi命令,

acpi -t   # or -V for all



-t | --thermal:显示热量信息


apt-cache show acpi开始:


描述-zh:在ACPI设备上显示信息
尝试复制
ACPI系统上“旧” apm命令的功能,包括电池和热量信息。
不支持
ACPI挂起,仅显示有关ACPI设备的信息。

主页:http://sourceforge.net/projects/acpiclient


在类似Ubuntu的系统上,您可以使用

安装它。 >
sudo apt-get install acpi


注意:您可以使用watch -n 1 -d acpi -V监视温度,也可以使用脚本(带或不带sensors命令)开始解析其输出(或date),添加颜色,记录下输出到文件...

while [[ 1 ]] ; do acpi -t | awk '{printf ("%2.2f ",)}'; date; sleep 1 ; done

#8 楼

您可以返回一个conky文件中的命令行以在屏幕保护程序上显示它。它仍然比不占用空间的applet感到肿。

sudo apt-get install conky


然后在/ home / user文件夹中构建您梦s以求的.conkyrc文件,并将其添加到您的应用程序在启动时启动。

IMP:有关conky设置,请参阅有关conky或预制.conkyrc,Ubuntu和ubuntu-fr论坛线程,Lifehacker等的教程。