feat: add system info thresholds at config
| | |
| | | channelCount: 0 |
| | | #硬盘个数 |
| | | diskCount: 2 |
| | | #Exec root command |
| | | sysServerPort: 18081 |
| | | sysThresholds: |
| | | - |
| | | value: 60 |
| | | color: #13ce66 |
| | | - |
| | | value: 80 |
| | | color: #FF9C4A |
| | | - |
| | | value: 95 |
| | | color: #f53d3d |
| | | - |
| | | value: 100 |
| | | color: #5d0000 |
| | | database: |
| | | driver: sqlite |
| | | name: sqlite3 |
| | |
| | | info := sys.GetSysInfo() |
| | | util.ResponseFormat(c, code.UpdateSuccess, info) |
| | | } |
| | | |
| | | // @Summary 查询系统状态阈值设置 |
| | | // @Description 获取当前系统的运行状态,CPU, GPU, 内存的阈值配置 |
| | | // @Produce json |
| | | // @Tags sysset |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Router /data/api-v/sysset/sysThresholds [GET] |
| | | func (sset SysSetController) GetSysThresholds(c *gin.Context) { |
| | | util.ResponseFormat(c, code.UpdateSuccess, config.Server.SysThresholds) |
| | | } |
| | |
| | | "github.com/spf13/viper" |
| | | ) |
| | | |
| | | type threshold struct { |
| | | Value int `mapstructure: "value"` |
| | | Color string `mapstructure: "color"` |
| | | } |
| | | type server struct { |
| | | Runmode string `mapstructure: "runmode"` |
| | | JwtSecret string `mapstructure: "jwtSecret"` |
| | |
| | | ChannelCount string `mapstructure: "channelCount"` //通道个数 |
| | | DiskCount string `mapstructure: "diskCount"` //硬盘个数 |
| | | |
| | | SysServerPort string `mapstructure: "SysServerPort"` |
| | | SysServerPort string `mapstructure: "sysServerPort"` |
| | | SysThresholds []threshold `mapstructure: "sysThresholds"` |
| | | } |
| | | |
| | | var Server = &server{} |
| | |
| | | vsset.POST("/updateClock", ssController.SetSysClock) |
| | | vsset.GET("/ntpTest", ssController.TestNTPServer) |
| | | vsset.GET("/sysinfo", ssController.GetSysInfo) |
| | | vsset.GET("/sysThresholds", ssController.GetSysThresholds) |
| | | } |
| | | |
| | | //算法库操作 |