Nanopatch to the proxmox ve 3.3 web interface for displaying lmsensors

  • Tutorial
Greetings, colleagues.

Recently, a small task has appeared for a general assessment of the state of a host machine with proxmox, with which they work almost exclusively through the web interface. Simply, before starting long-term demanding tasks (and a little later), I would like to see that the machine is “alive” and the load does not lead to a potentially dangerous situation, everything is cool and not overloaded. It is clear that there are more advanced things like nagios / munin, etc., with different notification and control schemes for the situation, beautiful graphs and storage of the entire data history. But we will nevertheless narrow down the task of contemplating simple textual information that can be obtained by one console command. And we will display this information in the table row in the Summary tab for the node.

So lm sensors- software that allows you to collect information about different sensors in the system - temperature, voltage and fan speed. We will use it, set:
apt-get install lm-sensors

Next, run sensors-detect, select yes / no to scan the necessary categories of sensors in the system and then request full information about them:

Now the patch itself (not git, but "manual"). Before starting the changes, we make copies of the files, we understand that this should all happen in the "non-working" service time. Well, all the fear and risk in which case - naturally on you. Also remember that all this will fly off after the next proxmox update by you.

1. The server part is the Nodes perl module, in it we need the / api2 / json / nodes / NODENAME / status handler:
vi /usr/share/perl5/PVE/API2/

We go to about 262 line and add this:
$res->{sensinfo} = `sensors`;

Pearl experts can wrap this string with the condition for the sensors command to be available on the machine.

2. Client side - pvemanager javascript module:

We go to about 12572 line and add these:
var render_sensinfo = function(value) {
  return "
" + value + "
"; }

Find a line below
var rows = {

and in the order of the rows in the table that is convenient for you (I added it after rootfs), below, add this:
sensinfo : { header: gettext('Sensors information'), required: true, renderer: render_sensinfo },

We reboot the server (or unload the pearl module, how to do it on the fly - I don’t know yet, not a pearl bar). Now we go into the web-interface, select the node, click the Summary tab and observe the information on the sensors updated every second. It looks something like this:

In principle, using this basis, you can display any information you need through the second-time status alerts of nodes, not just sensors. It is important to understand that launching the collection of such information should not take much time (an order or two less than a second).

If someone has the time and desire to formalize this result into something more public (pull-request in pve-manager) - you're welcome. But I personally do not see this as a special need, the task of monitoring temperature and fans in the minimum necessary version for me has been solved.

Thank you for your attention, I hope the information above will be useful to someone.


1. LM Sensors website: .
2. GitHub repository pve-manager: .
3. Proxmox itself: .

Also popular now: