标签:als stat rest targe fun 动手 ble erer ext
转自我的个人博客:PVE添加cpu温度显示---U盘安装Proxmox VE(三)
作为放家里的小Server,对整个服务器的温度监控还是很有必要的,当初选择pve也是因为pve可diy程度比较高。
先上修改后的效果图:
废话不多说,动手吧。
一、安装lm-sensors
apt-get install lm-sensors
安装成功后,可以通过命令查看cpu温度:
root@home:~# sensors acpitz-virtual-0 Adapter: Virtual device temp1: +27.8°C (crit = +74.0°C) temp2: +29.8°C (crit = +74.0°C) coretemp-isa-0000 Adapter: ISA adapter Package id 0: +38.0°C (high = +68.0°C, crit = +73.0°C) Core 0: +36.0°C (high = +68.0°C, crit = +73.0°C) Core 1: +35.0°C (high = +68.0°C, crit = +73.0°C) Core 2: +34.0°C (high = +68.0°C, crit = +73.0°C) Core 3: +38.0°C (high = +68.0°C, crit = +73.0°C)
星际蜗牛的暴力风扇虽然吵,但是不得不佩服散热能力确实强。
二、编辑修改文件
1、/usr/share/perl5/PVE/API2/Nodes.pm
搜索my $dinfo = df(‘/‘, 1);
以pve5.4.3为例,在296行:
293 $res->{pveversion} = PVE::pvecfg::package() . "/" . 294 PVE::pvecfg::version_text(); 295 296 my $dinfo = df(‘/‘, 1); # output is bytes 297
添加:$res->{thermalstate} = `sensors`;
修改后:
$res->{pveversion} = PVE::pvecfg::package() . "/" . PVE::pvecfg::version_text(); $res->{thermalstate} = `sensors`; my $dinfo = df(‘/‘, 1); # output is bytes
2、/usr/share/pve-manager/js/pvemanagerlib.js
2.1、搜索PVE.panel.StatusView,修改height为320
16876 Ext.define(‘PVE.node.StatusView‘, { 16877 extend: ‘PVE.panel.StatusView‘, 16878 alias: ‘widget.pveNodeStatus‘, 16879 16880 height: 300, 16881 bodyPadding: ‘20 15 20 15‘, 16882 16883 layout: { 16884 type: ‘table‘, 16885 columns: 2, 16886 tableAttrs: { 16887 style: { 16888 width: ‘100%‘ 16889 } 16890 } 16891 },
2.2、搜索PVE Manager Version
16990 { 16991 itemId: ‘version‘, 16992 colspan: 2, 16993 printBar: false, 16994 title: gettext(‘PVE Manager Version‘), 16995 textField: ‘pveversion‘, 16996 value: ‘‘ 16997 }
在后面添加一个item,修改后为
{ itemId: ‘version‘, colspan: 2, printBar: false, title: gettext(‘PVE 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} ℃` } }
三、重启pve web管理服务
systemctl restart pveproxy
至此,就已经成功添加了pve web管理端cpu温度显示。
PVE添加cpu温度显示---U盘安装Proxmox VE(三)
标签:als stat rest targe fun 动手 ble erer ext
原文地址:https://www.cnblogs.com/xiaobo060/p/12830014.html