LingxinMeng 1 gadu atpakaļ
vecāks
revīzija
4075e55e12

+ 9 - 1
amd64/web_server/handler/h_monitor.go

@@ -14,6 +14,8 @@ type DeviceMonitor struct {
 	TotalCpuUsage    string `db:"total_cpu_usage" json:"totalCpuUsage"`       // cpu总占用
 	TotalMemoryUsage string `db:"total_memory_usage" json:"totalMemoryUsage"` // 内存总占用
 	Top10Process     string `db:"top10_process" json:"top10Process"`          // cpu占用前十的进程信息
+	DeviceNumber     string `db:"device_number" json:"deviceNumber"`          // cpu占用前十的进程信息
+	SocIp            string `db:"soc_ip" json:"socIp"`                        // cpu占用前十的进程信息
 }
 
 // SaveDeviceMonitor 保存实车上传的监控信息
@@ -30,7 +32,13 @@ func SaveDeviceMonitor(c *gin.Context) {
 	}
 	// 插入到数据库
 	sqlTemplate, _ := util.ReadFile(c_db.SqlFilesMap["insert_device_monitor.sql"])
-	if err := c_db.DoTx(sqlTemplate, []any{param.TotalCpuUsage, param.TotalMemoryUsage, param.Top10Process}); err != nil {
+	if err := c_db.DoTx(sqlTemplate, []any{
+		param.TotalCpuUsage,
+		param.TotalMemoryUsage,
+		param.Top10Process,
+		param.DeviceNumber,
+		param.SocIp,
+	}); err != nil {
 		c_log.GlobalLogger.Error("插入数据报错:", err)
 		c.JSON(http.StatusBadRequest, commonEntity.Response{
 			Code: 500,

+ 2 - 2
amd64/web_server/sql/insert_device_monitor.sql

@@ -1,2 +1,2 @@
-insert into device_monitor(total_cpu_usage, total_memory_usage, top10_process)
-values (?, ?, ?)
+insert into device_monitor(total_cpu_usage, total_memory_usage, top10_process,device_number,soc_ip)
+values (?,?,?,?,?)