feat(monitoring): 增加网络总量和进程计数监控

- 在 net.go 中添加总量统计功能,记录上次采样值
- 在 main.go 中添加进程计数监控
- 修改 remote.go 中的 JSON 字段名称
- 优化 report 函数,增加网络总量和进程计数数据
This commit is contained in:
Akizon77
2025-04-12 22:50:56 +08:00
parent c2a9148d4c
commit f785c0044c
4 changed files with 113 additions and 14 deletions

View File

@@ -16,10 +16,10 @@ type RemoteConfig struct {
Swap bool `json:"swap"`
Load bool `json:"load"`
Uptime bool `json:"uptime"`
Temperature bool `json:"temperature"`
Temperature bool `json:"temp"`
Os bool `json:"os"`
Disk bool `json:"disk"`
Network bool `json:"network"`
Network bool `json:"net"`
Process bool `json:"process"`
Interval int `json:"interval"`
Connections bool `json:"connections"`
@@ -38,7 +38,7 @@ func LoadRemoteConfig(endpoint string, token string) (RemoteConfig, error) {
var err error
for attempt := 1; attempt <= maxRetry; attempt++ {
resp, err = http.Get(endpoint,)
resp, err = http.Get(endpoint)
if err == nil && resp.StatusCode == http.StatusOK {
break
}