在Linux上檢查CPU和硬盤溫度的方法
引言
為了更好地監(jiān)測您的Linux系統(tǒng)的硬件健康狀況,如CPU與硬盤溫度、風扇轉(zhuǎn)速等關鍵指標,采用lm_sensors
與hddtemp
這兩款強大工具是明智之選。以下是關于這些工具的詳盡指南,包括它們的功能介紹、安裝步驟以及如何配置lm_sensors
,旨在為您提供一個清晰且優(yōu)化的操作流程。
lm_sensors:全方位硬件監(jiān)控解決方案
功能概述:lm_sensors
是一個開源項目,專為Linux系統(tǒng)設計,用于實時監(jiān)測系統(tǒng)內(nèi)部的溫度、電壓、風扇轉(zhuǎn)速等重要硬件狀態(tài)。它通過與各種傳感器芯片通信,提供精確的硬件健康數(shù)據(jù),是維護系統(tǒng)穩(wěn)定性的得力助手。
特色工具:
- s-tui:作為
lm_sensors
的一個現(xiàn)代化界面補充,s-tui
(Stress Terminal UI)是一個基于終端的實時監(jiān)控界面,能直觀展示CPU負載、溫度及頻率變化,同時控制風扇速度,非常適合追求高效監(jiān)控體驗的用戶。
基本命令:
sensors
:顯示當前所有傳感器讀數(shù)。sensors -s
:依據(jù)配置文件設定傳感器閾值。sensors –bus-list
:為配置文件生成適配的總線聲明。sudo sensors-detect
:自動檢測并配置系統(tǒng)支持的傳感器。
hddtemp:硬盤溫度的專業(yè)守護者
功能介紹:hddtemp
專注于硬盤溫度監(jiān)控,通過讀取兼容SMART(自我監(jiān)控、分析和報告技術)的硬盤驅(qū)動器信息,提供精確的硬盤溫度數(shù)據(jù)。它不僅適用于IDE/SATA硬盤,還支持部分SCSI硬盤,是確保硬盤長期可靠性的理想工具。
安裝指南(針對主流Linux發(fā)行版):
Fedora:
sudo dnf install lm_sensors hddtemp
Debian/Ubuntu:
sudo apt-get install lm-sensors hddtemp
或使用較新的apt
命令:
sudo apt install lm-sensors hddtemp
Arch Linux及其衍生版:
sudo pacman -S lm_sensors hddtemp
RHEL/CentOS:
sudo yum install lm_sensors hddtemp
注意:CentOS 8及以上版本或RHEL 8+推薦使用dnf
命令代替yum
。
openSUSE Leap:
sudo zypper install lm_sensors hddtemp
配置lm_sensors:
安裝完畢后,執(zhí)行以下命令以自動檢測并配置lm_sensors
:
sudo sensors-detect $ sudo sensors-detect # sensors-detect revision $Revision$ # System: LENOVO 80NV [Lenovo ideapad Y700-15ISK] (laptop) # Board: LENOVO Allsparks 5A # Kernel: 4.19.6-1-MANJARO x86_64 # Processor: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (6/94/3) 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. Some south bridges, CPUs or memory controllers contain embedded sensors. Do you want to scan for them? This is totally safe. (YES/no): YES Module cpuid loaded successfully. Silicon Integrated Systems SIS5595... No VIA VT82C686 Integrated Sensors... No VIA VT8231 Integrated Sensors... No AMD K8 thermal sensors... No AMD Family 10h thermal sensors... No AMD Family 11h thermal sensors... No AMD Family 12h and 14h thermal sensors... No AMD Family 15h thermal sensors... No AMD Family 16h thermal sensors... No AMD Family 17h thermal sensors... No AMD Family 15h power sensors... No AMD Family 16h power sensors... No Intel digital thermal sensor... Success! (driver `coretemp') Intel AMB FB-DIMM thermal sensor... No Intel 5500/5520/X58 thermal sensor... No VIA C7 thermal sensor... No VIA Nano thermal sensor... No Some Super I/O chips contain embedded 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): YES Probing for Super-I/O at 0x2e/0x2f Trying family `National Semiconductor/ITE'... No Trying family `SMSC'... No Trying family `VIA/Winbond/Nuvoton/Fintek'... No Trying family `ITE'... No Probing for Super-I/O at 0x4e/0x4f Trying family `National Semiconductor/ITE'... Yes Found unknown chip with ID 0x8371 Some hardware monitoring chips are 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): YES Probing for `National Semiconductor LM78' 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 Lastly, we can probe the I2C/SMBus adapters for connected hardware monitoring devices. This is the most risky part, and while it works reasonably well on most systems, it has been reported to cause trouble on some systems. Do you want to probe the I2C/SMBus adapters now? (YES/no): YES Using driver `i2c-i801' for device 0000:00:1f.4: Sunrise Point-H (PCH) Module i2c-dev loaded successfully. Next adapter: SMBus I801 adapter at 6040 (i2c-0) Do you want to scan it? (YES/no/selectively): YES Next adapter: i915 gmbus dpc (i2c-1) Do you want to scan it? (yes/NO/selectively): YES Next adapter: i915 gmbus dpb (i2c-2) Do you want to scan it? (yes/NO/selectively): yes Next adapter: i915 gmbus dpd (i2c-3) Do you want to scan it? (yes/NO/selectively): yes Next adapter: DPDDC-A (i2c-4) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0000 (i2c-5) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0001 (i2c-6) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0002 (i2c-7) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0005 (i2c-8) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0006 (i2c-9) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0007 (i2c-10) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0008 (i2c-11) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0009 (i2c-12) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-aux-000a (i2c-13) Do you want to scan it? (yes/NO/selectively): yes Client found at address 0x18 Probing for `Analog Devices ADM1021'... No Probing for `Analog Devices ADM1021A/ADM1023'... No Probing for `Maxim MAX1617'... No Probing for `Maxim MAX1617A'... No Probing for `Maxim MAX1668'... No Probing for `Maxim MAX1805'... No Probing for `Maxim MAX1989'... No . . Probing for `Fintek F75121R/F75122R/RG (VID+GPIO)'... No Probing for `Fintek F75111R/RG/N (GPIO)'... No Probing for `ITE IT8201R/IT8203R/IT8206R/IT8266R'... No Client found at address 0x77 Probing for `Asus Mozart-2'... No Now follows a summary of the probes I have just done. Just press ENTER to continue: Driver `coretemp': * Chip `Intel digital thermal sensor' (confidence: 9) Do you want to generate /etc/conf.d/lm_sensors? (YES/no): YES Created symlink /etc/systemd/system/multi-user.target.wants/lm_sensors.service → /usr/lib/systemd/system/lm_sensors.service. Unloading i2c-dev... OK Unloading cpuid... OK
執(zhí)行以下命令查看CPU溫度。
$ sensors nouveau-pci-0100 Adapter: PCI adapter GPU core: +0.60 V (min = +0.60 V, max = +1.20 V) temp1: -0.0°C (high = +95.0°C, hyst = +3.0°C) (crit = +105.0°C, hyst = +5.0°C) (emerg = +135.0°C, hyst = +5.0°C) coretemp-isa-0000 Adapter: ISA adapter Package id 0: +35.0°C (high = +100.0°C, crit = +100.0°C) Core 0: +33.0°C (high = +100.0°C, crit = +100.0°C) Core 1: +35.0°C (high = +100.0°C, crit = +100.0°C) Core 2: +33.0°C (high = +100.0°C, crit = +100.0°C) Core 3: +32.0°C (high = +100.0°C, crit = +100.0°C) Print the temperatures in degrees Fahrenheit instead of Celsius. $ sensors -f nouveau-pci-0100 Adapter: PCI adapter GPU core: +0.60 V (min = +0.60 V, max = +1.20 V) temp1: +32.0°F (high = +203.0°F, hyst = +37.4°F) (crit = +221.0°F, hyst = +41.0°F) (emerg = +275.0°F, hyst = +41.0°F) coretemp-isa-0000 Adapter: ISA adapter Package id 0: +96.8°F (high = +212.0°F, crit = +212.0°F) Core 0: +95.0°F (high = +212.0°F, crit = +212.0°F) Core 1: +95.0°F (high = +212.0°F, crit = +212.0°F) Core 2: +91.4°F (high = +212.0°F, crit = +212.0°F) Core 3: +91.4°F (high = +212.0°F, crit = +212.0°F)
顯示硬盤溫度。
$ sudo hddtemp /dev/sda2 /dev/sda2:WDC WD10SPCX-24HWST1:32°C
在Linux中安裝Psensor
psensor是 Linux 下的圖形化硬件溫度監(jiān)視器。該應用程序設計簡單且易于使用。 CPU和內(nèi)存消耗并不大。
它可以監(jiān)控:
- 主板和 CPU 傳感器的溫度(使用 lm 傳感器)。
- NVidia GPU 的溫度(使用 XNVCtrl)。
- ATI/AMD GPU 的溫度(在官方發(fā)行版存儲庫中未啟用,請參閱啟用其支持的說明)。
- 硬盤驅(qū)動器的溫度(使用 hddtemp 或 libatasmart)。
- 風扇的轉(zhuǎn)速(使用流明傳感器)。
- CPU 使用率(從 0.6.2.10 開始并使用 Gtop2)。
到此這篇關于在Linux上檢查CPU和硬盤溫度的方法的文章就介紹到這了,更多相關Linux檢查CPU和硬盤溫度內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
centos redhat系列對抗ddos之居家必備利器 banip.txt
本文可以用于redhat centos 系列 linux 系統(tǒng)的 屏蔽多連接ip,具有抗ddos功能的代碼。2010-11-11使用 Apache Superset 可視化 ClickHouse 數(shù)據(jù)的兩種方法
Apache Superset是一個強大的BI工具,它提供了查看和探索數(shù)據(jù)的方法。它在 ClickHouse 用戶中也越來越受歡迎。今天將介紹安裝 Superset 的 2 種方法,通過示例代碼給大家介紹的非常詳細,需要的朋友參考下吧2021-06-06linux環(huán)境下安裝jdk和Tomcat詳細步驟
大家好,本篇文章主要講的是linux環(huán)境下安裝jdk和Tomcat詳細步驟,感興趣的同學趕快來看一看吧,對你有幫助的話記得收一下,方便下次瀏覽2021-12-12