health

package
v1.3.7-alpha1107 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSystemInfo

func GetSystemInfo() (*host.InfoStat, error)

func GetSystemUsers

func GetSystemUsers() ([]*host.UserStat, error)

Types

type DiskStat

type DiskStat struct {
	Total uint64 `json:"total,omitempty"`
	Used  uint64 `json:"used,omitempty"`
}

type ExternalNetInterfaceInfo

type ExternalNetInterfaceInfo struct {
	Addrs string `json:"addrs"`
}

type ExternalNetworkInfo

type ExternalNetworkInfo struct {
	Addr string `json:"ex_addr"`
}

func GetExternalIp

func GetExternalIp() (ExternalNetworkInfo, error)

type HealthInfo

type HealthInfo struct {
	Timestamp     int64   `json:"timestamp"`
	CPUPercent    float64 `json:"cpu_percent"`
	MemoryPercent float64 `json:"memory_percent"`
	// kb/sec
	NetworkUpload   float64 `json:"network_upload"`
	NetworkDownload float64 `json:"network_download"`
	// kb/sec
	DiskWrite float64   `json:"disk_write"`
	DiskRead  float64   `json:"disk_read"`
	DiskUsage *DiskStat `json:"disk_usage"`
}

type NetInterfaceAddr

type NetInterfaceAddr struct {
	Network string `json:"network"`
	Address string `json:"address"`
}

type NetInterfaceInfo

type NetInterfaceInfo struct {
	Index          int                 `json:"index"`
	MTU            int                 `json:"mtu"`
	Name           string              `json:"name"`
	HardwareAddr   string              `json:"hardware_addr"`
	Flags          string              `json:"flags"`
	Addrs          []*NetInterfaceAddr `json:"addrs"`
	MulticastAddrs []*NetInterfaceAddr `json:"multicase_addrs"`
}

func (*NetInterfaceInfo) String

func (p *NetInterfaceInfo) String() (str string)

type NetworkInfo

type NetworkInfo struct {
	Interfaces []*NetInterfaceInfo `json:"interfaces"`
}

func GetNetworkInfo

func GetNetworkInfo() (*NetworkInfo, error)

type SystemMatrix

type SystemMatrix struct {
	NodeId            string           `json:"node_id"`
	GOARCH            string           `json:"arch"`
	GOOS              string           `json:"os"`
	Version           string           `json:"version"`
	Users             []*host.UserStat `json:"users"`
	ExternalNetwork   string           `json:"external_network"`
	Network           *NetworkInfo     `json:"network"`
	Matrix            *host.InfoStat   `json:"matrix"`
	HealthInfos       []*HealthInfo    `json:"health_infos"`
	NodeAliveDuration uint64           `json:"node_alive_duration"`
}

func NewSystemMatrixBase

func NewSystemMatrixBase() (*SystemMatrix, error)

func (*SystemMatrix) GetMainMacAndMainNetAddr

func (p *SystemMatrix) GetMainMacAndMainNetAddr() (mainMac, mainNetAddr string)

获取主mac

func (*SystemMatrix) GetMainUser

func (p *SystemMatrix) GetMainUser() (mainUser string)

获取主User

func (*SystemMatrix) String

func (p *SystemMatrix) String() (str string)

func (*SystemMatrix) UserToString

func (p *SystemMatrix) UserToString() (allUser string)

所有用户tostring

Jump to

Keyboard shortcuts

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