Skip to content

Proxmox VE modifications to add temperature sensors

Notifications You must be signed in to change notification settings

alexleigh/pve-mods

Repository files navigation

pve-mods

Modifications to Proxmox Virtual Environment in order to add CPU and hard drive temperature readings (powered by lm-sensors) to the PVE web-based management interface.

Temperature readings on the desktop version of the management interface:

PVE GUI desktop screenshot

Temperature readings on the mobile version of the management interface:

PVE GUI mobile screenshot

Since the mobile version does not auto-refresh statuses, another enhancement included in these mods is the addition of an Auto-refresh on/off toggle in the mobile Node status view.

Disclaimer

These enhancements involve modifying files distributed by Proxmox packages. As such, they should be used on hobby projects only. Also, any updates to the affected Proxmox packages will erase the modifications.

Requirements

lm-sensors needs to be installed on the hypervisor for the probes to work. To install lm-sensors, run the following on the hypervisor:

apt install lm-sensors

To show hard drive temperatures, the drivetemp module must be loaded for lm-sensors to report SMART temperature readings. To manually load the drivetemp module, run the following on the hypervisor:

modprobe drivetemp

To confirm the SMART temperature readings are working, run the sensors command on the hypervisor:

sensors

Once the hard drive temperature sensors are confirmed to be working, you can configure the system to load the drivetemp module at boot.

Usage

The simple way to apply these modifications is by examining the patch files in one of the patches directories. Caution: directly applying these patches to the PVE distribution files should only be done if the PVE packages on your system match the version these patches were generated against. The patch directories and the versions of the Proxmox packages they were generated against are:

v7.3-6-pwt3.5.5

  • pve-manager 7.3-6
  • proxmox-widget-toolkit 3.5.5

v7.4-3-pwt3.6.3

  • pve-manager 7.4-3
  • proxmox-widget-toolkit 3.6.3

v7.4-3-pwt3.6.4

  • pve-manager 7.4-3
  • proxmox-widget-toolkit 3.6.4

v7.4-3-pwt3.6.5

  • pve-manager 7.4-3
  • proxmox-widget-toolkit 3.6.5

v7.4-3-pwt3.7.0

  • pve-manager 7.4-3
  • proxmox-widget-toolkit 3.7.0

v7.4-13-pwt3.7.3

  • pve-manager 7.4-13
  • proxmox-widget-toolkit 3.7.3

v7.4-16-pwt3.7.3

  • pve-manager 7.4-16
  • proxmox-widget-toolkit 3.7.3

v8.0.4-pwt4.0.6

  • pve-manager 8.0.4
  • proxmox-widget-toolkit 4.0.6

Warning
If the package versions installed on your system are different from these, the patches should not be applied. Instead, use the patches as a reference to make manual modifications to the affected files.

Note
The patches also hardcode the names of various lm-sensors probes to extract temperature readings. On your system, the probes you'd like to display and their corresponding names are likely different. This is another reason why you might want to make manual modifications rather than apply the patch files.

Making manual modifications

To make manual modifications, using the patch files as a reference, first take a look at each of the patch files, and note the path to the file being patched shown in the first line of each patch file. These paths correspond to the files you will need to modify on your system. For each path, open the file in your preferred editor, for example by running the following command on your hypervisor:

nano /usr/share/perl5/PVE/API2/Nodes.pm

With the file open, inspect the corresponding change in the patch file, and make the same changes on your system file.

Of the four patched files, pvemanager-mobile.js.patch is an optional change that only needs to be applied if you are interested in adding the temperature readings to the mobile site. The other three files must be modified in order for the temperature readings to work.

Several of the patched files deal with names of lm-sensors probes. To determine how to make the correct changes for your system, first run the sensors command in JSON mode to inspect the JSON output:

sensors -j

For each probe whose value you wish to display, take note of the JSON path to reach the dictionary containing the temperature values, as well as the keys of the current reading and critical value. The path and key names go into the %sensors_config hash in Nodes.pm. The keys of the %sensors_config can be any string as long as they are unique and do not collide with any existing keys in the $res hash. These key names in %sensors_config will be referenced by the JavaScript files used to display the temperatures.

With %sensors_config configured, modify pvemanagerlib.js to reference the configured probes. For each item, the valueField and maxField refer to one of the configured keys in %sensors_config. If you wish to enhance the mobile site as well, modify pvemanager-mobile.js to also reference the configured probes.

Depending on the number of probes you have configured, you may need to adjust the height of the status area in pvemanagerlib.js. Also, if an odd number of probes was added, you may need to add a spacer to preserve the layout of items lower on the status panel.

After all the modifications have been completed, restart the pve-proxy service for your changes to take effect:

systemctl restart pveproxy.service

If you have the pve-manager web interface open in a browser, you may need to refresh the page after restarting the pve-proxy service.

Build from source

Alternatively, the modified files can be built from Proxmox sources. The modifications have been committed to the following repositories:

To build the modified files in the v7.3-6-pwt3.5.5 directory, use the following branches:

To build the modified files in the v7.4-3-pwt3.6.3 directory, use the following branches:

To build the modified files in the v7.4-3-pwt3.6.4 directory, use the following branches:

To build the modified files in the v7.4-3-pwt3.6.5 directory, use the following branches:

To build the modified files in the v7.4-3-pwt3.7.0 directory, use the following branches:

To build the modified files in the v7.4-13-pwt3.7.3 directory, use the following branches:

To build the modified files in the v7.4-16-pwt3.7.3 directory, use the following branches:

To build the modified files in the v8.0.4-pwt4.0.6 directory, use the following branches:

Cloning the above two repositories and this repository in the same parent directory, and invoking make all in one of the versioned subdirectories, will generate all the modified files within the versioned subdirectory. Building these files requires a development environment where, at a minimum, the Proxmox packages pve-manager, proxmox-widget-toolkit, and pve-docs can be successfully built.

If you're making modifications on top of official Proxmox repositories, for the purpose of installing the modified files on a real system, make sure to check out the revision in the Proxmox repository which matches the version of the Proxmox package installed on the system being modified. For example, if you are modifying pve-manager, and the system you are targeting is running pve-manager 7.3-6, make sure to check out revision 723bb6e "bump version to 7.3-6" prior to making any changes. Otherwise, the modified file will contain changes other than the changes you intended.

Once the modified files have been built, running make install will install the files to the current system, replacing PVE distributed files. Prior to running make install, it is a good idea to run make backup to make a copy of the PVE distributed files. Running make restore will restore the backed up files, replacing the modified ones (make backup must have already been run for make restore to work.)