hostinfo

package
v0.0.0-...-a2bdee3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillFromClusterHardwareTable

func FillFromClusterHardwareTable(db *gorm.DB, m InfoMap) error

func FillFromClusterLoadTable

func FillFromClusterLoadTable(db *gorm.DB, m InfoMap) error

func FillInstances

func FillInstances(db *gorm.DB, m InfoMap) error

Types

type CPUInfo

type CPUInfo struct {
	Arch          string `json:"arch"`
	LogicalCores  int    `json:"logical_cores"`
	PhysicalCores int    `json:"physical_cores"`
}

type CPUUsageInfo

type CPUUsageInfo struct {
	Idle   float64 `json:"idle"`
	System float64 `json:"system"`
}

type Info

type Info struct {
	Host        string           `json:"host"`
	CPUInfo     *CPUInfo         `json:"cpu_info"`
	CPUUsage    *CPUUsageInfo    `json:"cpu_usage"`
	MemoryUsage *MemoryUsageInfo `json:"memory_usage"`

	// Containing unused partitions. The key is path in lower case.
	// Note: deviceName is not used as the key, since TiDB and TiKV may return different deviceName for the same device.
	Partitions map[string]*PartitionInfo `json:"partitions"`
	// The source instance type that provides the partition info.
	PartitionProviderType string `json:"-"`

	// Instances in the current host. The key is instance address
	Instances map[string]*InstanceInfo `json:"instances"`
}

func NewHostInfo

func NewHostInfo(hostname string) *Info

type InfoMap

type InfoMap = map[string]*Info

type InstanceInfo

type InstanceInfo struct {
	Type           string `json:"type"`
	PartitionPathL string `json:"partition_path_lower"`
}

type MemoryUsageInfo

type MemoryUsageInfo struct {
	Used  int `json:"used"`
	Total int `json:"total"`
}

type PartitionInfo

type PartitionInfo struct {
	Path   string `json:"path"`
	FSType string `json:"fstype"`
	Free   int    `json:"free"`
	Total  int    `json:"total"`
}

Jump to

Keyboard shortcuts

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