From eab9da94bb5c2ea0d0b311359103c81e0b4c8190 Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 6 May 2026 10:46:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=8D=E4=BD=8E=E8=B5=84=E6=BA=90=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E9=A1=B5=E8=87=AA=E5=8A=A8=E6=8E=A2=E9=92=88=E9=A2=91?= =?UTF-8?q?=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/dashboard/templates/system_status.html | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/admin/dashboard/templates/system_status.html b/admin/dashboard/templates/system_status.html index 6805fd2..79f8210 100644 --- a/admin/dashboard/templates/system_status.html +++ b/admin/dashboard/templates/system_status.html @@ -329,6 +329,11 @@ md2imgLoading: false, md2imgWarming: false, autoRefreshTimer: null, + // 资源监控页默认走“低频观察”模式: + // 1. 你当前更依赖邮件告警,而不是盯着面板秒级刷新; + // 2. 把轮询频率降到 30 秒,可以明显减少无意义请求; + // 3. 同时还能保留基础趋势观察能力,适合日常巡检。 + autoRefreshIntervalMs: 30000, md2imgHealth: null, trendHistory: { cpu: [], @@ -488,10 +493,14 @@ this.currentView = '14'; this.loadStatusOverview(false); this.loadMd2ImgHealth(); - // 资源页采用前端轮询即可满足日常观察,不需要为了监控再起单独守护进程。 + // 资源页继续采用前端轮询即可满足日常观察,不需要为了监控再起单独守护进程。 + // 这里改成更低频的 30 秒: + // 1. 减少后台接口请求频率; + // 2. 更贴合“异常靠邮件提醒,页面只做巡检”的使用方式; + // 3. 仍然足够支撑人工查看当前机器状态。 this.autoRefreshTimer = setInterval(() => { this.loadStatusOverview(false); - }, 10000); + }, this.autoRefreshIntervalMs); }, beforeDestroy() { if (this.autoRefreshTimer) { @@ -545,7 +554,11 @@ value: numeric, timestamp: Date.now() }); - // 只保留最近 18 个点,10 秒轮询时大约能覆盖近 3 分钟。 + // 只保留最近 18 个点,30 秒轮询时大约能覆盖近 9 分钟。 + // 这个窗口故意不做太长: + // 1. 目标是给当前巡检提供“最近一段时间”的趋势感知; + // 2. 再长就更适合落库做历史监控,而不是页面内存态缓存; + // 3. 对你现在的运维习惯来说,9 分钟窗口已经足够判断是否持续抬升。 while (next.length > 18) { next.shift(); }