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
/usr/share/pve-manager/js/pvemanagerlib.js
I got this far:
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: