apt install lm-sensors -y
传感器探测,命令:sensors-detect
全部选择yes即可,可能其中一个地方提示 ENTER,按 回车键 即可
sensors
vi /usr/share/perl5/PVE/API2/Nodes.pm
在里面搜索定位到 PVE::pvecfg::version_text();
在这行下面添加一行 $res->{sensorsInfo} = `sensors`;
vi /usr/share/pve-manager/js/pvemanagerlib.js
在里面搜索定位到 PVE Manager Version
在花括号结束的地方,另起一行,写入我们的代码
{
itemId: 'sensorsInfo',
colspan: 2,
printBar: false,
title: gettext('CPU温度'),
textField: 'sensorsInfo',
renderer:function(value)
{
const p0 = value.match(/Package id 0: +\+(\d+\.\d+)/)[1];
const c0 = value.match(/Core 0: +\+(\d+\.\d+)/)[1];
const c1 = value.match(/Core 1: +\+(\d+\.\d+)/)[1];
const c2 = value.match(/Core 2: +\+(\d+\.\d+)/)[1];
const c3 = value.match(/Core 3: +\+(\d+\.\d+)/)[1];
const c4 = value.match(/Core 4: +\+(\d+\.\d+)/)[1];
const c5 = value.match(/Core 5: +\+(\d+\.\d+)/)[1];
const c6 = value.match(/Core 6: +\+(\d+\.\d+)/)[1];
const c7 = value.match(/Core 7: +\+(\d+\.\d+)/)[1];
const c8 = value.match(/Core 8: +\+(\d+\.\d+)/)[1];
const c9 = value.match(/Core 9: +\+(\d+\.\d+)/)[1];
return `Package: ${p0} ℃ || 核心1: ${c0} ℃ | 核心2: ${c1} ℃ |
核心3: ${c2} ℃ | 核心4: ${c3} ℃ | 核心5: ${c4} ℃ | 核心6: ${c5} ℃|
核心7: ${c6} ℃ | 核心8: ${c7} ℃ | 核心9: ${c8} ℃ | 核心10: ${c9} ℃`
}
},
systemctl restart pveproxy
vi /usr/share/pve-manager/js/pvemanagerlib.js
搜索 widget.pveNodeStatus 按需求修改height值(每多一行数据增加20)
apt-get install hddtemp
chmod +s /usr/sbin/hddtemp
hddtemp /dev/sd?
vi /usr/share/perl5/PVE/API2/Nodes.pm
在里面搜索定位到 PVE::pvecfg::version_text();
在我们刚刚添加$res->{sensorsInfo} = `sensors`;这行下面添加
$res->{hddtemp} = `hddtemp /dev/sd?`;
vi /usr/share/pve-manager/js/pvemanagerlib.js
在里面搜索定位到 PVE Manager Version
在我们刚刚添加CPU温度下面 添加
{
itemId: 'hddtemp',
colspan: 2,
printBar: false,
title: gettext('硬盘温度'),
textField: 'hddtemp',
renderer: function(value)
{
value = value.replaceAll('Â', '');
return value.replaceAll('\n', '
');
}
},
systemctl restart pveproxy
$res->{hddtemp} = `hddtemp /dev/sd?`;
{
itemId: 'apcaccess',
colspan: 2,
printBar: false,
title: gettext('UPS信息'),
textField: 'apcaccess',
renderer: function(value)
{
const DATE = value.match(/DATE : (\d+-\d+-\d+ \d+:\d+:\d+)/)[1];
const STATUS = value.match(/STATUS : (.+)/)[1];
const LINEV = value.match(/LINEV : (\d+\.\d+)/)[1];
const LOADPCT = value.match(/LOADPCT : (\d+\.\d+)/)[1];
const BCHARGE = value.match(/CHARGE : (\d+\.\d+)/)[1];
const TIMELEFT = value.match(/TIMELEFT : (\d+\.\d+)/)[1];
const SENSE = value.match(/SENSE : (.+)/)[1];
return `更新时间:${DATE}
状态:${STATUS}
输入电压:${LINEV} V
负载:${LOADPCT} %
电池电量:${BCHARGE} %
电池可供电时间:${TIMELEFT} 分钟
电池灵敏度:${SENSE}
`
}