style: 监控信息接口
This commit is contained in:
@@ -28,21 +28,14 @@ type MonitorController struct {
|
|||||||
func (s *MonitorController) Load(c *gin.Context) {
|
func (s *MonitorController) Load(c *gin.Context) {
|
||||||
language := ctx.AcceptLanguage(c)
|
language := ctx.AcceptLanguage(c)
|
||||||
var querys struct {
|
var querys struct {
|
||||||
// 数据类型all/load/cpu/memory/io/network
|
Type string `form:"type" binding:"required,oneof=all load cpu memory io network"` // 数据类型all/load/cpu/memory/io/network
|
||||||
Type string `form:"type" binding:"required,oneof=all load cpu memory io network"`
|
StartTime int64 `form:"startTime" binding:"required"` // 开始时间
|
||||||
// 开始时间
|
EndTime int64 `form:"endTime" binding:"required"` // 结束时间
|
||||||
StartTime int64 `form:"startTime" binding:"required"`
|
NeType string `form:"neType"` // 网元类型
|
||||||
// 结束时间
|
NeID string `form:"neId"` // 网元ID
|
||||||
EndTime int64 `form:"endTime" binding:"required"`
|
Name string `form:"name"` // 名称,networ和io时有效
|
||||||
// 网元类型
|
|
||||||
NeType string `form:"neType"`
|
|
||||||
// 网元ID
|
|
||||||
NeID string `form:"neId"`
|
|
||||||
// 名称,networ和iok时有效
|
|
||||||
Name string `form:"name"`
|
|
||||||
}
|
}
|
||||||
err := c.ShouldBindQuery(&querys)
|
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||||
if err != nil {
|
|
||||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,13 @@ type SystemInfoController struct {
|
|||||||
//
|
//
|
||||||
// GET /
|
// GET /
|
||||||
func (s *SystemInfoController) Info(c *gin.Context) {
|
func (s *SystemInfoController) Info(c *gin.Context) {
|
||||||
c.JSON(200, result.OkData(map[string]any{
|
data := map[string]any{
|
||||||
"cpu": s.systemInfogService.CPUInfo(),
|
"cpu": s.systemInfogService.CPUInfo(),
|
||||||
"memory": s.systemInfogService.MemoryInfo(),
|
"memory": s.systemInfogService.MemoryInfo(),
|
||||||
"network": s.systemInfogService.NetworkInfo(),
|
"network": s.systemInfogService.NetworkInfo(),
|
||||||
"time": s.systemInfogService.TimeInfo(),
|
"time": s.systemInfogService.TimeInfo(),
|
||||||
"system": s.systemInfogService.SystemInfo(),
|
"system": s.systemInfogService.SystemInfo(),
|
||||||
"disk": s.systemInfogService.DiskInfo(),
|
"disk": s.systemInfogService.DiskInfo(),
|
||||||
}))
|
}
|
||||||
|
c.JSON(200, result.OkData(data))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user