shidahuilang / pve Goto Github PK
View Code? Open in Web Editor NEWPVE开启直通+CPU硬盘温度显示,风扇转速+一些群辉自用的小脚本
PVE开启直通+CPU硬盘温度显示,风扇转速+一些群辉自用的小脚本
显示温度那个脚本试了不支持7.4,改了无效,可以适配下不?我看你写了就懒得自己搞了
pve版本8.1.4
你没有添加过温度显示,退出脚本.
按任意键继续...
PVE优化脚本
┌──────────────────────────────────────────┐
1. 一键优化PVE(换源、去订阅等)
2. 配置PCI硬件直通
3. 设置CPU电源模式
4. 添加CPU、主板、硬盘温度显示
5. 删除CPU、主板、硬盘温度显示
├──────────────────────────────────────────┤
0. 退出
└──────────────────────────────────────────┘
请选择: [4]
pve版本8.1.4
lm-sensors 未安装,开始安装软件包
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package sysstat is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Unable to locate package lm-sensors
E: Unable to locate package nvme-cli
E: Package 'sysstat' has no installation candidate
E: Unable to locate package linux-cpupower
chmod: cannot access '/usr/sbin/nvme': No such file or directory
chmod: cannot access '/usr/sbin/hddtemp': No such file or directory
chmod: cannot access '/usr/sbin/turbostat': No such file or directory
Failed to set permissions for /usr/sbin/turbostat
软件包安装完成,检测硬件信息
./pve.sh: line 579: sensors-detect: command not found
没有找到任何驱动,似乎你的系统不支持或驱动安装失败。
是不支持吗?
我的机器是4核心cpu
{
itemId: 'thermal',
colspan: 2,
printBar: false,
title: gettext('CPU温度'),
textField: 'thermalstate',
renderer:function(value){
// const p0 = value.match(/Package id 0.*?\+([\d\.]+)Â/)[1]; // CPU包温度
const c0 = value.match(/Core 0.*?\+([\d\.]+)?/)[1]; // CPU核心1温度
const c1 = value.match(/Core 1.*?\+([\d\.]+)?/)[1]; // CPU核心2温度
const c2 = value.match(/Core 2.*?\+([\d\.]+)?/)[1]; // CPU核心3温度
const c3 = value.match(/Core 3.*?\+([\d\.]+)?/)[1]; // CPU核心4温度
// const b0 = value.match(/temp1.*?\+([\d\.]+)?/)[1]; // 主板温度
// const b1 = value.match(/temp2.*?\+([\d\.]+)?/)[1]; // 主板温度2
return ` 核心1: ${c0} ℃ | 核心2: ${c1} ℃ | 核心3: ${c2} ℃ | 核心4: ${c3} ℃` // 不带主板温度
// return `Package: ${p0} ℃ || 核心1: ${c0} ℃ | 核心2: ${c1} ℃ | 核心3: ${c2} ℃ | 核心4: ${c3} ℃ || 主板: ${b0} ℃ | ${b1} ℃ ` // 带主板温度
}
},
{
itemId: 'MHz',
colspan: 2,
printBar: false,
title: gettext('CPU频率'),
textField: 'cpusensors',
renderer:function(value){
const f0 = value.match(/cpu MHz.*?([\d]+)/)[1];
const f1 = value.match(/CPU min MHz.*?([\d]+)/)[1];
const f2 = value.match(/CPU max MHz.*?([\d]+)/)[1];
return `CPU实时: ${f0} MHz | 最小: ${f1} MHz | 最大: ${f2} MHz `
}
},
// /* 检测不到相关参数的可以注释掉---需要的注释本行即可
/* 风扇转速
{
itemId: 'RPM',
colspan: 2,
printBar: false,
title: gettext('CPU风扇'),
textField: 'thermalstate',
renderer:function(value){
const fan1 = value.match(/fan1:.*?\ ([\d.]+) R/)[1];
const fan2 = value.match(/fan2:.*?\ ([\d.]+) R/)[1];
return `CPU风扇: ${fan1} RPM | 系统风扇: ${fan2} RPM `
}
},
// 检测不到相关参数的可以注释掉---需要的注释本行即可 */
// /* 检测不到相关参数的可以注释掉---需要的注释本行即可
// NVME硬盘温度
{
itemId: 'nvme_ssd-temperatures',
colspan: 2,
printBar: false,
title: gettext('NVME硬盘'),
textField: 'nvme_ssd_temperatures',
renderer:function(value){
if (value.length > 0) {
let nvmedevices = value.matchAll(/^Model.*:\s*([\s\S]*?)(\n^Total.*\[[\s\S]*?\]$|\s{0}$)\n^Temperature:\s*([\d]+)\s*Celsius\n^Percentage.*([\d]+\%)\n^Data Units.*\[([\s\S]*?)\]\n^Data Units.*\[([\s\S]*?)\]\n^Power.*:\s*([\s\S]*?)\n/gm);
for (const nvmedevice of nvmedevices) {
for (var i=5; i<8; i++) {
nvmedevice[i] = nvmedevice[i].replace(/ |,/gm, '');
}
if (nvmedevice[2].length > 0) {
let nvmecapacity = nvmedevice[2].match(/.*\[([\s\S]*?)\]/);
nvmecapacity = nvmecapacity[1].replace(/ /, '');
value = `${nvmedevice[1]} | 已使用寿命: ${nvmedevice[4]} (累计读取: ${nvmedevice[5]}, 累计写入: ${nvmedevice[6]}) | 容量: ${nvmecapacity} | 已通电: ${nvmedevice[7]}小时 | 温度: ${nvmedevice[3]}°C\n`;
} else {
value = `${nvmedevice[1]} | 已使用寿命: ${nvmedevice[4]} (累计读取: ${nvmedevice[5]}, 累计写入: ${nvmedevice[6]}) | 已通电: ${nvmedevice[7]}小时 | 温度: ${nvmedevice[3]}°C\n`;
}
}
return value.replace(/\n/g, '<br>');
} else {
return `提示: 未安装硬盘或已直通硬盘控制器`;
}
}
},
// /* 检测不到相关参数的可以注释掉---需要的注释本行即可 */
// SATA硬盘温度
{
itemId: 'hdd-temperatures',
colspan: 2,
printBar: false,
title: gettext('SATA硬盘'),
textField: 'hdd_temperatures',
renderer:function(value){
if (value.length > 0) {
let devices = value.matchAll(/(\s*Model.*:\s*[\s\S]*?\n){1,2}^User.*\[([\s\S]*?)\]\n^\s*9[\s\S]*?\-\s*([\d]+)[\s\S]*?(\n(^19[0,4][\s\S]*?$){1,2}|\s{0}$)/gm);
for (const device of devices) {
if(device[1].indexOf("Family") !== -1){
devicemodel = device[1].replace(/.*Model Family:\s*([\s\S]*?)\n^Device Model:\s*([\s\S]*?)\n/m, '$1 - $2');
} else {
devicemodel = device[1].replace(/.*Model:\s*([\s\S]*?)\n/m, '$1');
}
device[2] = device[2].replace(/ |,/gm, '');
if(value.indexOf("Min/Max") !== -1){
let devicetemps = device[5].matchAll(/19[0,4][\s\S]*?\-\s*(\d+)(\s\(Min\/Max\s(\d+)\/(\d+)\)$|\s{0}$)/gm);
for (const devicetemp of devicetemps) {
value = `${devicemodel} | 容量: ${device[2]} | 已通电: ${device[3]}小时 | 温度: ${devicetemp[1]}°C\n`;
}
} else if (value.indexOf("Temperature") !== -1){
let devicetemps = device[5].matchAll(/19[0,4][\s\S]*?\-\s*(\d+)/gm);
for (const devicetemp of devicetemps) {
value = `${devicemodel} | 容量: ${device[2]} | 已通电: ${device[3]}小时 | 温度: ${devicetemp[1]}°C\n`;
}
} else {
value = `${devicemodel} | 容量: ${device[2]} | 已通电: ${device[3]}小时 | 提示: 未检测到温度传感器\n`;
}
}
return value.replace(/\n/g, '<br>');
} else {
return `提示: 未安装硬盘或已直通硬盘控制器`;
}
}
},
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.