|
@@ -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,
|