diff --git a/config.py b/config.py
index 19c82ec..4b9a4b1 100644
--- a/config.py
+++ b/config.py
@@ -26,6 +26,7 @@ APP_PORT = 16022
# 监控配置
DEFAULT_THRESHOLDS = {
'cpu': 80,
+ 'cpu_temp': 80,
'memory': 85,
'disk': 90,
'interval': 60
diff --git a/templates_full.txt b/templates_full.txt
index 839721b..262ea05 100644
--- a/templates_full.txt
+++ b/templates_full.txt
@@ -305,6 +305,16 @@
%
+
+
+
+ CPU 温度
+
+
+
+ °C
+
+
@@ -756,7 +766,7 @@
let realtimeTimer = null;
let realtimeInterval = 2; // 秒
let lastAlertTime = 0; // 上次警告时间
- let thresholds = { cpu: 80, memory: 85, disk: 90, interval: 60 };
+ let thresholds = { cpu: 80, cpu_temp: 80, memory: 85, disk: 90, interval: 60 };
let desktopNotifyEnabled = false;
function switchTab(tab) {
@@ -799,6 +809,7 @@
if (config.thresholds) {
thresholds = config.thresholds;
document.getElementById('thresholdCpu').value = thresholds.cpu || 80;
+ document.getElementById('thresholdCpuTemp').value = thresholds.cpu_temp || 80;
document.getElementById('thresholdMemory').value = thresholds.memory || 85;
document.getElementById('thresholdDisk').value = thresholds.disk || 90;
document.getElementById('thresholdInterval').value = thresholds.interval || 60;
@@ -811,6 +822,7 @@
// 保存阈值设置
async function saveThresholds() {
thresholds.cpu = parseInt(document.getElementById('thresholdCpu').value) || 80;
+ thresholds.cpu_temp = parseInt(document.getElementById('thresholdCpuTemp').value) || 80;
thresholds.memory = parseInt(document.getElementById('thresholdMemory').value) || 85;
thresholds.disk = parseInt(document.getElementById('thresholdDisk').value) || 90;
thresholds.interval = parseInt(document.getElementById('thresholdInterval').value) || 60;
@@ -935,6 +947,12 @@
if (data.disk.percent >= thresholds.disk) {
warnings.push(`磁盘使用率 ${data.disk.percent.toFixed(1)}% 超过阈值 ${thresholds.disk}%`);
}
+ if (data.cpu.temp_package_0 !== null && data.cpu.temp_package_0 >= thresholds.cpu_temp) {
+ warnings.push(`CPU0 温度 ${data.cpu.temp_package_0.toFixed(1)}°C 超过阈值 ${thresholds.cpu_temp}°C`);
+ }
+ if (data.cpu.temp_package_1 !== null && data.cpu.temp_package_1 >= thresholds.cpu_temp) {
+ warnings.push(`CPU1 温度 ${data.cpu.temp_package_1.toFixed(1)}°C 超过阈值 ${thresholds.cpu_temp}°C`);
+ }
if (warnings.length > 0) {
lastAlertTime = now;