[0.9.19] 进程数/连接数/负载 监控报警

This commit is contained in:
naiba
2021-08-15 16:38:05 +08:00
parent 68624b15d6
commit c9a9441f3e
9 changed files with 189 additions and 60 deletions

View File

@@ -265,10 +265,8 @@ func doTask(task *pb.Task) {
func reportState() {
var lastReportHostInfo time.Time
var err error
var now time.Time
defer println("reportState exit", time.Now(), "=>", err)
for {
now = time.Now()
// 为了更准确的记录时段流量inited 后再上传状态信息
if client != nil && inited {
monitor.TrackNetworkSpeed()
@@ -284,7 +282,7 @@ func reportState() {
client.ReportSystemInfo(context.Background(), monitor.GetHost().PB())
}
}
time.Sleep(time.Until(now.Add(time.Second)))
time.Sleep(time.Second)
}
}