Identifying specific devices when using sensors in ubuntu
Solution 1:
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.