Benutzer-Werkzeuge

Webseiten-Werkzeuge


public:realtimetemp

Display realtime CPU-Core Temperature in Node Status


Log into shell of your PVE as root.

apt install lm-sensors


Test function:

root@pve:~# sensors
 
	coretemp-isa-0000
	Adapter: ISA adapter
	Package id 0:  +23.0°C  (high = +84.0°C, crit = +100.0°C)
	Core 0:        +21.0°C  (high = +84.0°C, crit = +100.0°C)
	Core 1:        +21.0°C  (high = +84.0°C, crit = +100.0°C)
	Core 2:        +22.0°C  (high = +84.0°C, crit = +100.0°C)
	Core 3:        +19.0°C  (high = +84.0°C, crit = +100.0°C)


Backup original and add the output of information:

cp /usr/share/perl5/PVE/API2/Nodes.pm /usr/share/perl5/PVE/API2/Nodes.pm.bak;
nano /usr/share/perl5/PVE/API2/Nodes.pm



Search [F6] for „$dinfo“:

$res->{pveversion} = PVE::pvecfg::package() . "/" .
             PVE::pvecfg::version_text();
 
         my $dinfo = df('/', 1);     # output is bytes



Add the line:

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



Result looks like this:

$res->{pveversion} = PVE::pvecfg::package() . "/" .
            PVE::pvecfg::version_text();
 
        $res->{thermalstate} = `sensors`;
 
        my $dinfo = df('/', 1);     # output is bytes



Now press Ctrl+O to save and Ctrl+X to save and exit.

Now backup and edit the file „/usr/share/pve-manager/js/pvemanagerlib.js“

cp /usr/share/pve-manager/js/pvemanagerlib.js /usr/share/pve-manager/js/pvemanagerlib.js.bak;
nano /usr/share/pve-manager/js/pvemanagerlib.js



Search [F6] for „widget.pveNodeStatus“ and find this snippet:

Ext.define('PVE.node.StatusView', {
     extend: 'PVE.panel.StatusView',
     alias: 'widget.pveNodeStatus',
 
     height: 350,
     bodyPadding: '5 15 5 15',
 
     layout: {
         type: 'table',
         columns: 2,
         tableAttrs: {
             style: {
                 width: '100%'
             }
         }
     },


Change values of „bodyPadding“ to „10 15 10 15“

Don't close file yet

Search [F6] within the same file for „Manager Version“

{
             itemId: 'version',
             colspan: 2,
             printBar: false,
             title: gettext('Manager Version'),
             textField: 'pveversion',
             value: ''
         }



Add this snippet:

{
            itemId: 'thermal',
            colspan: 2,
            printBar: false,
            title: gettext('CPU Thermal State'),
            textField: 'thermalstate',
            renderer:function(value){
                const c0 = value.match(/Core 0.*?\+([\d\.]+)Â/)[1];
                const c1 = value.match(/Core 1.*?\+([\d\.]+)Â/)[1];
                const c2 = value.match(/Core 2.*?\+([\d\.]+)Â/)[1];
                const c3 = value.match(/Core 3.*?\+([\d\.]+)Â/)[1];
                return `Core 0: ${c0}| Core 1: ${c1}| Core 2: ${c2}| Core 3: ${c3}`
            }
        }



The complete snippet should look like this:

{
            itemId: 'version',
            colspan: 2,
            printBar: false,
            title: gettext('Manager Version'),
            textField: 'pveversion',
            value: ''
        },
        {
            itemId: 'thermal',
            colspan: 2,
            printBar: false,
            title: gettext('CPU Thermal State'),
            textField: 'thermalstate',
            renderer:function(value){
                const c0 = value.match(/Core 0.*?\+([\d\.]+)Â/)[1];
                const c1 = value.match(/Core 1.*?\+([\d\.]+)Â/)[1];
                const c2 = value.match(/Core 2.*?\+([\d\.]+)Â/)[1];
                const c3 = value.match(/Core 3.*?\+([\d\.]+)Â/)[1];
                return `Core 0: ${c0}| Core 1: ${c1}| Core 2: ${c2}| Core 3: ${c3}`
            }
        }



Now press Ctrl+O to save and Ctrl+X to save and exit.
And restart PVE Proxy Manager:

systemctl restart pveproxy



Enjoy!

public/realtimetemp.txt · Zuletzt geändert: 2024/05/01 14:20 von gerson

Seiten-Werkzeuge