cp /usr/share/pve-manager/js/pvemanagerlib.js /usr/share/pve-manager/js/pvemanagerlib.js.bak
cp /usr/share/perl5/PVE/API2/Nodes.pm /usr/share/perl5/PVE/API2/Nodes.pm.bak
apt install lm-sensors
sensors
执行结果参考
root@pve:/usr/share/pve-manager/js# sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +47.0°C (high = +94.0°C, crit = +100.0°C)
Core 0: +45.0°C (high = +94.0°C, crit = +100.0°C)
Core 1: +48.0°C (high = +94.0°C, crit = +100.0°C)
Core 2: +47.0°C (high = +94.0°C, crit = +100.0°C)
Core 3: +45.0°C (high = +94.0°C, crit = +100.0°C)
Core 4: +46.0°C (high = +94.0°C, crit = +100.0°C)
Core 5: +48.0°C (high = +94.0°C, crit = +100.0°C)
$res->{thermalstate} = `sensors`; # 检测CPU温度
提示:
由于硬盘未成功,请仅参考cpu部分,添加cpu配置到上图所示的地方
{ itemId: 'thermalstate', colspan: 2, printBar: false, title: gettext('CPU温度'), textField: 'thermalstate', renderer:function(value){ const p0 = value.match(/Package id 0.*?\+([\d\.]+)Â/)[1]; 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 `Package: ${p0} ℃ `; // 因为我是4个核心,所以添加4个。不同CPU核心数不一样,根据自身需求增加,或者也可以只保留1个Package温度 } },
提示1:这里的textField 名称必须与刚才修改的Nodes.pm里面配置的一致,然后item-id 需要全文唯一
提示2:注意 逗号括号不要少,不能用中文的逗号括号或者全角字符
systemctl restart pveproxy
重启完毕后CTRL+F5强制刷新下浏览器就可以看到了apt install hddtemp
安装完毕后执行命令查看:
hddtemp /dev/sd?
参考:
pve# hddtemp /dev/sd?
/dev/sda: SSD 128GB: 40°C
/dev/sdb: HGST HTS541010A9E680: 29°C
/dev/sdc: ST1000LM024 HN-M101MBB: S.M.A.R.T. not available
地址:https://www.leftso.com/article/1083.html