So close... I just want to display CPU, Nvme, HDD temps on summary page of Proxmox

tonynca

New Member
Jun 10, 2023
7
3
3
Okay, so I followed this guide and got most of it. Right now, I'm trying to get "renderer" function to display data it pulled from "hddtemp /dev/sda" command.

Here's the code so far... Be gentle I'm new to coding.

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

Code:
$res->{CPUtemperature} = `sensors`;
$res->{Nvmetemperature} = `sensors`;
$res->{HDDtemperature} = `hddtemp /dev/sda`;

/usr/share/pve-manager/js/pvemanagerlib.js

Code:
        {
            itemId: 'CPUtemperature',
            colspan: 2,
            printBar: false,
            title: gettext('CPU Temperature'),
            textField: 'CPUtemperature',
            renderer: function(value){
                const dieTemp = Array.from(value.matchAll(/Tccd.*?\+([\d\.]+)?/g), m=>m[1]);
                return dieTemp.map((element, index) => `CPU CCD${index+1}: ${element}℃`).join(' | ');
                                        }
        },
        {
            itemId: 'Nvmetemperature',
            colspan: 2,
            printBar: false,
            title: gettext('Nvme Temperature'),
            textField: 'Nvmetemperature',
            renderer: function(value){
                const nvmeTemps = Array.from(value.matchAll(/Composite.*?\+([\d\.]+)?/g), m=>m[1]);
return "Nvme: " + nvmeTemps.map((element, index) => `${element}℃`).join(' | ');
                                        }
        },
        {
            itemId: 'HDDtemperature',
            colspan: 2,
            printBar: false,
            title: gettext('HDD Temperature'),
            textField: 'HDDtemperature',
            renderer: function(value) {
                return value)
            }
        },

I got this far:
Screenshot 2023-06-14 000627.png
 
Hello,

do you actually have /dev/sda as device? Can you show output of
Bash:
ls -ld /dev/sd*

When I run “hddtemp /dev/sda” it outputs the temp, so yeah I get an output.

Here’s the output from the command you posted:

5ECF5B77-B697-444B-8D4A-30C511772B0E.jpeg
 
Last edited:
nice work, will that work for the summary page of the VM as well ?
for me, more helpfully would be
connected to which network (SDN)
info second drive
evtl firewall rules
and so on
 
Last edited:
I'm not sure about the summary page of the VM. Still new to all this so I dont know exactly where everything is yet.
 
Looking at the code you pasted and comparing it with the tutorial, seems the 'HDDtemperature' item is different. Have you tried the original one?

Disclaimer: I am not a coder, so if someone has more knowledge, do not hesitate;)
 
Looking at the code you pasted and comparing it with the tutorial, seems the 'HDDtemperature' item is different. Have you tried the original one?

Disclaimer: I am not a coder, so if someone has more knowledge, do not hesitate;)
If you look at his screen shot on his guide he doesn’t have it working. Lol

I’m trying to fix it so it works.

By the way the code above is for Ryzen 3900X. Not sure if it’ll work with other Ryzen as is if someone here is trying to reuse it.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!