[PATCH container 0/1] Add a module for hardware sensors reading

Davide Guerri davide.guerri at gmail.com
Tue Oct 14 21:36:00 CEST 2025


Hardware sensors (lmsensors) reading module. This module is used by an
API andpoint that will be submitted separately on the pve-manager repo.

The module queries /sys/class/hwmon to collect sensor readings from CPUs
(Intel, AMD), disks (NVMe, SATA/SAS via drivetemp), and fans through
various hardware drivers (expected to be installed on the pve node).
The module provides functions like read_temperatures() (which can filter
by cpu/disk/other/all types) and read_fan_speeds() that return structured
hashes containing current readings, sensor metadata (driver names, limits,
CPU topology info), and device mappings. 
It uses PVE::Tools utilities for file reading and directory traversal.

Example href for temperatures (disk, cpu and others can be read
separately):

# {
#     'coretemp/Core 0' => {
#         temperature => 45.0,      # in degrees Celsius
#         unit => 'celsius',
#         type => 'cpu',
#         driver => 'Intel',
#         max => 100.0,            # optional
#         critical => 100.0,       # optional
#         logical_core => 0,       # optional, for CPU cores
#         physical_core => 0,      # optional, for CPU cores
#         package => 0,            # optional, for CPU cores
#     },
#     'hwmon4/Sensor 1' => {
#         temperature => 35.0,      # in degrees Celsius
#         unit => 'celsius',
#         type => 'disk',
#         driver => 'SATA/SAS',
#         device => 'sda',         # block device name (for disks)
#     },
#     'hwmon1/Composite' => {
#         temperature => 42.0,      # in degrees Celsius
#         unit => 'celsius',
#         type => 'disk',
#         driver => 'NVMe',
#         device => 'nvme0n1',     # block device name (for disks)
#     },
#     'hwmon2/Composite' => {
#         temperature => 43.0,      # in degrees Celsius
#         unit => 'celsius',
#         type => 'disk',
#         driver => 'NVMe',
#         device => 'nvme1n1',     # block device name (for disks)
#     },
#     ...
# }

Example href for fan speed reading

# {
#     'nct6775/CPU Fan' => {
#         speed => 1500,       # in RPM
#         unit => 'rpm',
#         driver => 'Nuvoton',
#         min => 0,           # optional
#         max => 2000,        # optional
#         target => 1500,     # optional
#         alarm => 0,         # optional, 0 or 1
#     },
#     ...
# }

Davide Guerri (1):
  sensors: add hardware sensor module for CPUs, disks, and fans

 src/Makefile          |   1 +
 src/PVE/SensorInfo.pm | 385 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 386 insertions(+)
 create mode 100644 src/PVE/SensorInfo.pm

-- 
2.50.1 (Apple Git-155)




More information about the pve-devel mailing list