statistics

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Statistics

func Statistics(ctx *cputil.Context, req *Req) ([][]any, error)

Types

type DiskIoReq

type DiskIoReq struct {
	Id        uint   // cloud id
	Dev       string // vda vdd
	StartTime int64  // 开始毫秒时间戳(1699344000000) UTC+8
	EndTime   int64  // 结束毫秒时间戳(1699344060000) UTC+8
}

DiskIoReq 硬盘IO

type DiskIoResp

type DiskIoResp struct {
	List []DiskIoRespList `json:"list"`
}

func DiskIo

func DiskIo(ctx *cputil.Context, req *DiskIoReq) (*DiskIoResp, error)

type DiskIoRespList

type DiskIoRespList struct {
	Time      string  `json:"time"`       // 时间
	Read      float64 `json:"read"`       // 读取速度(Byte)
	Write     float64 `json:"write"`      // 写入速度(Byte)
	ReadIops  float64 `json:"read_iops"`  // 读取IOPS
	WriteIops float64 `json:"write_iops"` // 写入IOPS
}

type KvmInfoReq

type KvmInfoReq struct {
	Id        uint  // cloud id
	StartTime int64 // 开始毫秒时间戳(1699344000000) UTC+8
	EndTime   int64 // 结束毫秒时间戳(1699344060000) UTC+8
}

KvmInfoReq CPU+内存使用量

type KvmInfoResp

type KvmInfoResp struct {
	List []KvmInfoRespList `json:"list"`
}

func KvmInfo

func KvmInfo(ctx *cputil.Context, req *KvmInfoReq) (*KvmInfoResp, error)

type KvmInfoRespList

type KvmInfoRespList struct {
	Time     string  `json:"time"`      // 时间
	CPU      float64 `json:"cpu"`       // CPU使用率(n.xy)
	MemTotal int64   `json:"mem_total"` // 总内存(Byte)
	MemUsed  int64   `json:"mem_used"`  // 已使用内存(Byte)
}

type NetAdapterNetworkReq

type NetAdapterNetworkReq struct {
	Id            uint  // cloud id
	NetworkOffset uint8 // 网卡顺序 从0开始
	StartTime     int64 // 开始毫秒时间戳(1699344000000) UTC+8
	EndTime       int64 // 结束毫秒时间戳(1699344060000) UTC+8
}

NetAdapterNetworkReq 网卡带宽

type NetAdapterNetworkResp

type NetAdapterNetworkResp struct {
	List []NetAdapterRespList `json:"list"` // 流量列表
	Stat NetDetailResp        `json:"stat"` // 汇总数据
}

func NetAdapterNetwork

func NetAdapterNetwork(ctx *cputil.Context, req *NetAdapterNetworkReq) (*NetAdapterNetworkResp, error)

type NetAdapterReq

type NetAdapterReq struct {
	Id            uint   // cloud id
	Kvm           string // kvm id
	NetworkOffset uint8  // 网卡顺序 从0开始
	Usage         bool   // 是否查询用量(流量),默认 查询网卡/带宽
	StartTime     int64  // 开始毫秒时间戳(1699344000000) UTC+8
	EndTime       int64  // 结束毫秒时间戳(1699344060000) UTC+8
}

NetAdapterReq 网卡

type NetAdapterResp

type NetAdapterResp struct {
	List []NetAdapterRespList `json:"list"`
}

func NetAdapter

func NetAdapter(ctx *cputil.Context, req *NetAdapterReq) (*NetAdapterResp, error)

type NetAdapterRespList

type NetAdapterRespList struct {
	Time string  `json:"time"` // 时间
	In   float64 `json:"in"`   // 进带宽(bps)
	Out  float64 `json:"out"`  // 出带宽(bps)
}

type NetAdapterUsageReq

type NetAdapterUsageReq struct {
	Id            uint  // cloud id
	NetworkOffset uint8 // 网卡顺序 从0开始
	StartTime     int64 // 开始毫秒时间戳(1699344000000) UTC+8
	EndTime       int64 // 结束毫秒时间戳(1699344060000) UTC+8
}

NetAdapterUsageReq 用量排行

type NetAdapterUsageResp

type NetAdapterUsageResp struct {
	List []NetAdapterRespList `json:"list"` // 流量列表
	Stat NetTotalResp         `json:"stat"` // 汇总数据
}

func NetAdapterUsage

func NetAdapterUsage(ctx *cputil.Context, req *NetAdapterUsageReq) (*NetAdapterUsageResp, error)

type NetDetailReq

type NetDetailReq struct {
	NodeId    uint   `url:"node_id,omitempty"`    // node_id
	KvmIfName string `url:"kvm_ifname,omitempty"` // $kvmid.$NetworkOffset
	StartTime int64  `url:"st,omitempty"`         // 开始毫秒时间戳(1699344000000) UTC+8
	EndTime   int64  `url:"et,omitempty"`         // 结束毫秒时间戳(1699344060000) UTC+8
}

NetDetailReq http://~/v1/net_detail?node_id=14&kvm_ifname=kvm1146.0&st=1699432018000&et=1699438740820

func (*NetDetailReq) Body

func (r *NetDetailReq) Body() any

func (*NetDetailReq) Form

func (r *NetDetailReq) Form() (form url.Values)

func (*NetDetailReq) Header

func (r *NetDetailReq) Header() http.Header

func (*NetDetailReq) Method

func (r *NetDetailReq) Method() string

func (*NetDetailReq) Url

func (r *NetDetailReq) Url() string

func (*NetDetailReq) Values

func (r *NetDetailReq) Values() (values url.Values)

type NetDetailResp

type NetDetailResp struct {
	Accept struct {
		Total   float64 `json:"total"`   // 总流量(Byte)
		Max     float64 `json:"max"`     // 最大流量(Byte)
		New     float64 `json:"new"`     // 最新流量(Byte)
		Average float64 `json:"average"` // 平均流量(Byte)
	} `json:"accept"` // 流入流量(Byte)
	Send struct {
		Total   float64 `json:"total"`   // 总流量(Byte)
		Max     float64 `json:"max"`     // 最大流量(Byte)
		New     float64 `json:"new"`     // 最新流量(Byte)
		Average float64 `json:"average"` // 平均流量(Byte)
	} `json:"send"` // 流出流量(Byte)
	Max struct {
		Total  float64 `json:"total"`
		Send   float64 `json:"send"`
		Accept float64 `json:"accept"`
	} `json:"95"` // ignored
}

func NetDetail

func NetDetail(ctx *cputil.Context, req *NetDetailReq) (*NetDetailResp, error)

type NetTotalReq

type NetTotalReq struct {
	NodeId    uint   `url:"node_id,omitempty"`    // node_id
	KvmIfName string `url:"kvm_ifname,omitempty"` // $kvmid.$NetworkOffset
}

NetTotalReq 查询总流量 http://~/v1/net_total?node_id=14&kvm=kvm1146&type=net_adapter&kvm_ifname=kvm1146.0&status=1&st=1699432018000&et=1699439971121

func (*NetTotalReq) Body

func (r *NetTotalReq) Body() any

func (*NetTotalReq) Form

func (r *NetTotalReq) Form() (form url.Values)

func (*NetTotalReq) Header

func (r *NetTotalReq) Header() http.Header

func (*NetTotalReq) Method

func (r *NetTotalReq) Method() string

func (*NetTotalReq) Url

func (r *NetTotalReq) Url() string

func (*NetTotalReq) Values

func (r *NetTotalReq) Values() (values url.Values)

type NetTotalResp

type NetTotalResp struct {
	Time   string `json:"time"`   // 时间
	Accept int64  `json:"accept"` // 接收流量(Byte)
	Send   int64  `json:"send"`   // 发送流量(Byte)
}

func NetTotal

func NetTotal(ctx *cputil.Context, req *NetTotalReq) (*NetTotalResp, error)

type Req

type Req struct {
	Kvm       string `url:"kvm,omitempty"`  // kvmid
	Type      string `url:"type,omitempty"` // kvm_info
	StartTime int64  `url:"st,omitempty"`   // 开始毫秒时间戳(1699344000000) UTC+8
	EndTime   int64  `url:"et,omitempty"`   // 结束毫秒时间戳(1699344060000) UTC+8

	Dev       string `url:"dev,omitempty"`        // for disk io
	KvmIfName string `url:"kvm_ifname,omitempty"` // for net adapter
	Status    string `url:"status,omitempty"`     // for net adapter
}

Req http://~/v1/statistics?node_id=13&kvm=kvm1145&type=kvm_info&st=1699344000000&et=1699344060000

func (*Req) Body

func (r *Req) Body() any

func (*Req) Form

func (r *Req) Form() (form url.Values)

func (*Req) Header

func (r *Req) Header() http.Header

func (*Req) Method

func (r *Req) Method() string

func (*Req) Url

func (r *Req) Url() string

func (*Req) Values

func (r *Req) Values() (values url.Values)

Jump to

Keyboard shortcuts

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