Skip to content

Instantly share code, notes, and snippets.

@meetnick
Last active January 17, 2025 12:40
Show Gist options
  • Save meetnick/8426d6f680573ef027f3de54178353e6 to your computer and use it in GitHub Desktop.
Save meetnick/8426d6f680573ef027f3de54178353e6 to your computer and use it in GitHub Desktop.
Add CPU Temperature to Proxmox Node Summary

Install lm-sensors

apt-get install lm-sensors

Backup files

cp /usr/share/perl5/PVE/API2/Nodes.pm /usr/share/perl5/PVE/API2/Nodes.pm.bak
cp /usr/share/pve-manager/js/pvemanagerlib.js /usr/share/pve-manager/js/pvemanagerlib.js.bak

Change Proxmox (not-persistent across updates)

Add the following to file /usr/share/perl5/PVE/API2/Nodes.pm

$res->{thermalstate} = `sensors`;

Between lines:

 
         $res->{pveversion} = PVE::pvecfg::package() . "/" .
            PVE::pvecfg::version_text();

        $res->{thermalstate} = `sensors`;

        my $dinfo = df('/', 1);     # output is bytes

Add the following snippet to: /usr/share/pve-manager/js/pvemanagerlib.js

        {
            itemId: 'version',
            colspan: 2,
            printBar: false,
            title: gettext('Manager Version'),
            textField: 'pveversion',
            value: '',
        },
        // HERE
        {
            itemId: 'thermal',
            colspan: 2,
            printBar: false,
            title: gettext('CPU temperature'),
            textField: 'thermalstate',
            renderer:function(value){
            // const c0 = value.match(/Core 0.*?\+([\d\.]+)?/)[1];
            // const c1 = value.match(/Core 1.*?\+([\d\.]+)?/)[1];
            // return `Core: ${c0} | ${c1}`
            const cP = value.match(/Package id0.*?\+([\d\.]+)?/)[1];
            return `Package: ${cP}`
         }
       }
       // UNTIL HERE
    ],

Restart pve proxy
systemctl restart pveproxy

Hard reload Summary screen (cleaning cache): CTRL + SHIFT + R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment