服务器往往没有图像界面,在我们需要检查服务器上CPU,HDD硬盘,SSD固态硬盘,GPU及主板芯片组温度时,需要借助一些工具,这里以 Ubuntu 22.04
为例。
CPU 主板温度
- 安装
lm-sensors
sudo apt install lm-sensors
- 运行
sensors-detect
命令扫描各设备识别传感器,并一直输入yes即可; - 运行
sensors
命令,得到各硬件传感器温度:
huan@8500t:~$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +32.0°C (high = +94.0°C, crit = +100.0°C)
Core 0: +32.0°C (high = +94.0°C, crit = +100.0°C)
Core 1: +30.0°C (high = +94.0°C, crit = +100.0°C)
Core 2: +30.0°C (high = +94.0°C, crit = +100.0°C)
Core 3: +29.0°C (high = +94.0°C, crit = +100.0°C)
Core 4: +31.0°C (high = +94.0°C, crit = +100.0°C)
Core 5: +29.0°C (high = +94.0°C, crit = +100.0°C)
ucsi_source_psy_USBC000:001-isa-0000
Adapter: ISA adapter
in0: 0.00 V (min = +0.00 V, max = +0.00 V)
curr1: 0.00 A (max = +0.00 A)
acpitz-acpi-0
Adapter: ACPI interface
temp1: +30.0°C
pch_cannonlake-virtual-0
Adapter: Virtual device
temp1: +37.0°C
nvme-pci-0100
Adapter: PCI adapter
Composite: +30.9°C (low = -0.1°C, high = +71.8°C)
(crit = +89.8°C)
这其中:
– coretemp-isa-0000
:CPU封装温度和每个核心的温度及最大温度阈值。
– acpitz-acpi-0
为主板温度
– pch_cannonlake-virtual-0
:平台控制器集线器可以理解为集成南桥温度
– nvme-pci-0100
:NVME温度
如果服务器上有GPU显卡,应该还会看到类似 nouveau-pci-0100
的传感器显示的是显卡温度。
HDD硬盘温度
- 安装
hddtemp
直接sudo apt install hddtemp
安装可能会出现报错:
sudo apt install hddtemp
The hddtemp package is not available, but some other package references it. This may mean that the package is missing, obsolete, or only available from some other source.
需要手动下载并安装
sudo apt update
wget http://archive.ubuntu.com/ubuntu/pool/universe/h/hddtemp/hddtemp_0.3-beta15-53_amd64.deb
sudo apt install ./hddtemp_0.3-beta15-53_amd64.deb
- 指定磁盘运行即可:
huan@8500t:~$ sudo hddtemp /dev/sd?
[sudo] password for huan:
/dev/sda: WDC WD42PURU-XXXXX: 33°C