大网数据广告活动
服务器运维问答

Identifying specific devices when using sensors in ubuntu

· 52CE 我爱测

I am running the sensors command in Ubuntu 20.04 to try and get a temperature reading for my NVME SSD drives. However, although I can see the drives I am not sure which one is which: nvme-pci-2300 Adapter: PCI adapter Composite: …

问题原文

原帖链接 · Joseph · CC BY-SA 4.0

I am running the sensors command in Ubuntu 20.04 to try and get a temperature reading for my NVME SSD drives. However, although I can see the drives I am not sure which one is which:

nvme-pci-2300
Adapter: PCI adapter
Composite:    +45.9°C  (low  =  -5.2°C, high = +79.8°C)
                       (crit = +84.8°C)

nvme-pci-6100
Adapter: PCI adapter
Composite:    +52.9°C  (low  = -273.1°C, high = +79.8°C)
                       (crit = +86.8°C)
Sensor 1:     +52.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +51.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 3:     +52.9°C  (low  = -273.1°C, high = +65261.8°C)

nvme-pci-2e00
Adapter: PCI adapter
Composite:    +51.9°C  (low  = -273.1°C, high = +81.8°C)
                       (crit = +84.8°C)
Sensor 1:     +51.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +57.9°C  (low  = -273.1°C, high = +65261.8°C)

The only obvious difference between each of these is the number that comes after nvme-pci- but these don't seem to correspond to my model numbers and Googling them just results in a whole load of different models and brands.

I tried running lspci and lsblk in the hope that there would be something else to help me to link these numbers to the devices but there is not.

In short, I just want to know with absolute certainty the temperature of each NVME SSD device in my system.

已采纳解答

原帖链接 · anx · CC BY-SA 4.0

The folders in the respective /sys/class/hwmon/hwmon*/ contain a device/ symlink that points to the device the sensor is registered with. After enumerating the sensors you can retrieve vendor, path or serial from that subfolder (e.g. start with /sys/class/hwmon/hwmon*/device/modalias).

Instead of working around the output format of sensors or reading sysfs yourself, you probably want to use SMART interface, which is much more specifically designed to deal with drives, e.g.

smartctl -a /dev/disk/by-id/vendor_serial

Each invocation of smartctl will give you one set of status & temperatures, and you probably already have integration for SMART in your monitoring toolbox anyway.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-06-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。