监控CPU磁盘网络数据库

This commit is contained in:
TsMask
2023-08-15 21:38:05 +08:00
parent 3672b73683
commit bfd3be9f03
3 changed files with 412 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
package monitor
import "time"
type MonitorBase struct {
ID uint `xorm:"id" json:"id"`
CreatedAt time.Time `xorm:"created_at" json:"createdAt"`
UpdatedAt time.Time `xorm:"updated_at" json:"updatedAt"`
Cpu float64 `xorm:"cpu" json:"cpu"`
LoadUsage float64 `xorm:"load_usage" json:"loadUsage"`
CpuLoad1 float64 `xorm:"cpu_load1" json:"cpuLoad1"`
CpuLoad5 float64 `xorm:"cpu_load5" json:"cpuLoad5"`
CpuLoad15 float64 `xorm:"cpu_load15" json:"cpuLoad15"`
Memory float64 `xorm:"memory" json:"memory"`
DbSize uint `xorm:"db_size" json:"dbSize"`
}
type MonitorIO struct {
ID uint `xorm:"id" json:"id"`
CreatedAt time.Time `xorm:"created_at" json:"createdAt"`
UpdatedAt time.Time `xorm:"updated_at" json:"updatedAt"`
Name string `xorm:"name" json:"name"`
Read uint64 `xorm:"read" json:"read"`
Write uint64 `xorm:"write" json:"write"`
Count uint64 `xorm:"count" json:"count"`
Time uint64 `xorm:"time" json:"time"`
}
type MonitorNetwork struct {
ID uint `xorm:"id" json:"id"`
CreatedAt time.Time `xorm:"created_at" json:"createdAt"`
UpdatedAt time.Time `xorm:"updated_at" json:"updatedAt"`
Name string `xorm:"name" json:"name"`
Up float64 `xorm:"up" json:"up"`
Down float64 `xorm:"down" json:"down"`
}
type MonitorSearch struct {
Param string `json:"param" validate:"required,oneof=all cpu memory load io network"`
Info string `json:"info"`
StartTime time.Time `json:"startTime"`
EndTime time.Time `json:"endTime"`
}
type MonitorData struct {
Param string `json:"param" validate:"required,oneof=cpu memory load io network"`
Date []time.Time `json:"date"`
Value []interface{} `json:"value"`
}