海运的博客

Proxmox7.1显示CPU/主板/硬盘温度

发布时间:November 24, 2021 // 分类: // No Comments

安装获取温度软件:

apt install lm-sensors
apt install hddtemp
chmod +s /usr/sbin/hddtemp

修改/usr/share/perl5/PVE/API2/Nodes.pm:

PVE::pvecfg::version_text();
#以下为添加
$res->{thermal} = `sensors -j`;  
$res->{thermal_hdd} = `hddtemp /dev/sd?`;
#结束
my $dinfo = df('/', 1);     # output is bytes

修改/usr/share/pve-manager/js/pvemanagerlib.js:

{
        itemId: 'version',
                colspan: 2,
                printBar: false,
                title: gettext('PVE Manager Version'),
                textField: 'pveversion',
                value: '',
},
#以下为添加内容
        {
                itemId: 'thermal',
                colspan: 2,
                printBar: false,
                title: gettext('CPU/主板温度'),
                textField: 'thermal',
                renderer: function(value) {
                        //value = JSON.parse(value.replaceAll('Â', ''));
                        value = JSON.parse(value);
                        const cpu0 = value['coretemp-isa-0000']['Package id 0']['temp1_input'].toFixed(1);
                        const cpu1 = value['coretemp-isa-0000']['Core 0']['temp2_input'].toFixed(1);
                        const cpu2 = value['coretemp-isa-0000']['Core 1']['temp3_input'].toFixed(1);
                        const cpu3 = value['coretemp-isa-0000']['Core 2']['temp4_input'].toFixed(1);
                        const cpu4 = value['coretemp-isa-0000']['Core 3']['temp5_input'].toFixed(1);
                        const board = value['acpitz-acpi-0']['temp1']['temp1_input'].toFixed(1);
                        return `Package: ${cpu0}°C | Core: ${cpu1}° C | ${cpu2}° C | ${cpu3}° C | Board: ${board}°C`; 
                }
        },
        {
                itemId: 'thermal-hdd',
                colspan: 2,
                printBar: false,
                title: gettext('硬盘温度'),
                textField: 'thermal_hdd',
                renderer: function(value) {
                        value = value.replaceAll('Â', '');
                        return value.replaceAll('\n', '<br>');
                }
        },
#结束
],

修改显示区域高度:

Ext.define('PVE.node.StatusView', {
    extend: 'Proxmox.panel.StatusView',
    alias: 'widget.pveNodeStatus',
    #height: 300,
    height: 450,
    bodyPadding: '15 5 15 5',

    layout: {

效果如下:
2021-11-24_154258.jpg

参考:
https://64g.cc/index.php/2021/07/18/proxmox-7-0-%E6%B7%BB%E5%8A%A0cpu-nvme-hdd%E6%B8%A9%E5%BA%A6%E7%9B%91%E6%8E%A7/
https://zry.io/archives/285

标签:proxmox, pve

发表评论

分类
最新文章
最近回复
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
  • 孤狼: 擦。。。。apcupsd会失联 nut在冲到到100的时候会ONBATT进入关机状态,我想想办...
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
  • knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
  • Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...