Utilization interface to supplement disk information
This commit is contained in:
parent
be80d0cd95
commit
6ea3cdb364
2 changed files with 9 additions and 2 deletions
|
@ -270,7 +270,7 @@ func GetSystemHardwareInfo(c *gin.Context) {
|
|||
// @Success 200 {string} string "ok"
|
||||
// @Router /sys/utilization [get]
|
||||
func GetSystemUtilization(c *gin.Context) {
|
||||
var data = make(map[string]interface{}, 6)
|
||||
var data = make(map[string]interface{})
|
||||
cpu := service.MyService.System().GetCpuPercent()
|
||||
num := service.MyService.System().GetCpuCoreNum()
|
||||
cpuData := make(map[string]interface{})
|
||||
|
@ -299,7 +299,9 @@ func GetSystemUtilization(c *gin.Context) {
|
|||
}
|
||||
|
||||
data["net"] = newNet
|
||||
|
||||
for k, v := range service.MyService.Notify().GetSystemTempMap() {
|
||||
data[k] = v
|
||||
}
|
||||
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: data})
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ type NotifyServer interface {
|
|||
SendStorageBySocket(message notify.StorageMessage)
|
||||
SendNotify(path string, message map[string]interface{})
|
||||
SettingSystemTempData(message map[string]interface{})
|
||||
GetSystemTempMap() map[string]interface{}
|
||||
}
|
||||
|
||||
type notifyServer struct {
|
||||
|
@ -442,7 +443,11 @@ func SendMeg() {
|
|||
// }
|
||||
|
||||
// }
|
||||
func (i *notifyServer) GetSystemTempMap() map[string]interface{} {
|
||||
|
||||
return i.SystemTempMap
|
||||
|
||||
}
|
||||
func NewNotifyService(db *gorm.DB) NotifyServer {
|
||||
return ¬ifyServer{db: db, SystemTempMap: make(map[string]interface{})}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue