fix: 修复Agent指标时区查询
- 统一Agent报告存储与查询的UTC时间边界 - 修复监控大屏、历史图表及离线判断取不到最新数据 - 增加UTC与UTC+8场景回归测试
This commit is contained in:
1 parent
d9106dde6e
commit
7bc416d22a
6 files changed
+83
-9
No files matched your search
@@ -227,7 +227,8 @@ func (e *AlertEngine) checkOfflineAlerts() {
|
||||
e.db.Select("ip, hostname").Group("ip").Find(&servers)
|
||||
|
||||
// 收集所有 agent_reports 中活跃上报的主机名(最近 3 分钟内有上报)
|
||||
threeMinAgo := time.Now().Add(-offlineThreshold)
|
||||
// Agent 报告统一使用 UTC,避免 SQLite 时区文本比较导致误报离线。 // Logan.Li
|
||||
threeMinAgo := time.Now().UTC().Add(-offlineThreshold)
|
||||
|
||||
var activeHostnames []string
|
||||
e.db.Model(&model.AgentReport{}).
|
||||
|
||||
Reference in new issue
Block a user