Score:1

Identifying specific devices when using sensors in ubuntu

cn flag

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.

cn flag
@anx Yes, you are absolutely right. I was way too focused on trying to get the info from the sensors command! If you'd like to post this as an answer then I will mark it as correct.
Score:1
fr flag
anx

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.