|
@@ -3,6 +3,7 @@ package config
|
|
|
import (
|
|
|
"cicv-data-closedloop/common/config/c_log"
|
|
|
"cicv-data-closedloop/common/util"
|
|
|
+ "encoding/json"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -10,13 +11,18 @@ import (
|
|
|
func SendResourceUsage() {
|
|
|
for {
|
|
|
time.Sleep(time.Duration(2) * time.Second)
|
|
|
+ top10Cpu, top10Mem := util.GetTop10CpuAndMem()
|
|
|
+ top10CpuJson, _ := json.MarshalIndent(top10Cpu, "", " ")
|
|
|
+ top10MemJson, _ := json.MarshalIndent(top10Mem, "", " ")
|
|
|
responseString, err := util.HttpPostJsonWithHeaders(
|
|
|
CloudConfig.Monitor.Url,
|
|
|
map[string]string{"Authorization": "U9yKpD6kZZDDe4LFKK6myAxBUT1XRrDM"},
|
|
|
map[string]string{
|
|
|
"totalCpuUsage": util.ToString(util.GetCpuPercent()),
|
|
|
"totalMemoryUsage": util.ToString(util.GetMemoryPercent()),
|
|
|
- "top10Process": util.ToString(util.GetTop10Cpu()),
|
|
|
+ "top10Process": string(top10CpuJson),
|
|
|
+ "top10Cpu": string(top10CpuJson),
|
|
|
+ "top10Mem": string(top10MemJson),
|
|
|
"deviceNumber": LocalConfig.EquipmentNo,
|
|
|
"socIp": LocalConfig.Node.Ip,
|
|
|
},
|