monitor

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessHostInformation

func ProcessHostInformation(hostInfo *model.HostInfo) error

func ProcessPerformanceStats

func ProcessPerformanceStats(stats *model.SysStats) error

Types

type CpuInfo

type CpuInfo struct {
	Num        int32   `json:"num"`
	VendorId   string  `json:"vendorId"`
	Family     string  `json:"family"`
	PhysicalId string  `json:"physicalId"`
	Cores      int32   `json:"cores"`
	ModelName  string  `json:"modelName"`
	Mhz        float32 `json:"mhz"`
}

type CpuStat

type CpuStat struct {
	PhysicalCores int32   `json:"physicalCores"`
	LogicalCores  int32   `json:"logicalCores"`
	UsedPercent   float32 `json:"usedPercent"`
}

type DiskStat

type DiskStat struct {
	Total       float32 `json:"total"`
	Used        float32 `json:"used"`
	UsedPercent float32 `json:"usedPercent"`
}

type HostInfo

type HostInfo struct {
	Ip              string     `json:"ip"`
	HostName        string     `json:"hostName"`
	UpTime          string     `json:"upTime"`
	Platform        string     `json:"platform"`
	PlatformVersion string     `json:"platformVersion"`
	KernelVersion   string     `json:"kernelVersion"`
	KernelArch      string     `json:"kernelArch"`
	CpuInfos        []*CpuInfo `json:"cpuInfos"`
	Time            *time.Time `json:"time"`
}

type MemoryStat

type MemoryStat struct {
	Total       float32 `json:"total"`
	Used        float32 `json:"used"`
	UsedPercent float32 `json:"usedPercent"`
}

type SysStats

type SysStats struct {
	Ip            string      `json:"ip"`
	Cpu           *CpuStat    `json:"cpu"`
	VirtualMemory *MemoryStat `json:"virtualMemory"`
	SwapMemory    *MemoryStat `json:"swapMemory"`
	Disk          *DiskStat   `json:"disk"`
	Time          *time.Time  `json:"time"`
}

type SysStatsApi

type SysStatsApi struct {
}

func GetSysStatsApi

func GetSysStatsApi() *SysStatsApi

func (*SysStatsApi) DeleteHost

func (s *SysStatsApi) DeleteHost(c *gin.Context)

DeleteHost godoc

@Summary	删除一条主机监控记录
@Tags		性能监控
@Produce	application/json
@Param		ip	query		string	true	"目标主机ip地址"
@Success	200	{object}	R.Result
@Router		/monitor/host [delete]

func (*SysStatsApi) GetHostInfo

func (s *SysStatsApi) GetHostInfo(c *gin.Context)

GetHostInfo godoc

@Summary	获取主机信息
@Tags		性能监控
@Produce	application/json
@Param		ip	query		string	true	"目标主机ip地址"
@Success	200	{object}	R.Result{value=HostInfo}
@Router		/monitor/host-info [get]

func (*SysStatsApi) GetList

func (s *SysStatsApi) GetList(c *gin.Context)

GetList godoc

@Summary	查询监控服务器列表
@Tags		性能监控
@Produce	application/json
@Param		keyword		query		string	false	"按照IP模糊搜索"
@Param		page		query		int64	false	"页码"
@Param		pageSize	query		int64	false	"每页查询条数"
@Success	200			{object}	R.Result{value=res.PageableData[SysStats]}
@Router		/monitor/list [get]

func (*SysStatsApi) GetPerformanceStats

func (s *SysStatsApi) GetPerformanceStats(c *gin.Context)

GetPerformanceStats godoc

@Summary	获取最新性能监控数据
@Tags		性能监控
@Produce	application/json
@Param		ip	query		string	true	"目标主机ip地址"
@Success	200	{object}	R.Result{value=SysStats}
@Router		/monitor/performance-stats [get]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL