stats

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HostInfo = make(map[string]Section)

Functions

func GetSshEntry

func GetSshEntry(name string) (host string, port int, user, keyfile string)

func ParseSshConfig

func ParseSshConfig(path string) bool

func SshConnect

func SshConnect(user, addr, keyPath string) (*ssh.Client, error)

Types

type CPUInfo

type CPUInfo struct {
	User    float32
	Nice    float32
	System  float32
	Idle    float32
	Iowait  float32
	Irq     float32
	SoftIrq float32
	Steal   float32
	Guest   float32
}

type Cgroup

type Cgroup struct {
	Version            string
	Path               string
	CpuUsage           float64
	MemoryUsageCurrent int
	MemoryUsageLimit   int
	IoReadBytes        int
	IoWriteBytes       int
	Open               bool
	Childs             []*Cgroup
	Parent             *Cgroup
}

type FSInfo

type FSInfo struct {
	Device     string
	MountPoint string
	Used       uint64
	Free       uint64
}

type NetIntfInfo

type NetIntfInfo struct {
	IPv4 string
	IPv6 string
	Rx   uint64
	Tx   uint64
}

type Section

type Section struct {
	Hostname     string
	Port         int
	User         string
	IdentityFile string
}

type SshFetcher

type SshFetcher struct {
	Client *ssh.Client
	Logger *logger.Logger
	Stats  *Stats
}

func NewSshFetcher

func NewSshFetcher(client *ssh.Client) *SshFetcher

func (*SshFetcher) GetAllStats

func (s *SshFetcher) GetAllStats() []error

func (*SshFetcher) ValidateOS

func (s *SshFetcher) ValidateOS()

ValidateOS - rtop only support for Linux system

type Stats

type Stats struct {
	Uptime       time.Duration
	Hostname     string
	Load1        string
	Load5        string
	Load10       string
	RunningProcs string
	TotalProcs   string
	MemTotal     uint64
	MemFree      uint64
	MemBuffers   uint64
	MemCached    uint64
	SwapTotal    uint64
	SwapFree     uint64
	FSInfos      []FSInfo
	NetIntf      map[string]NetIntfInfo
	CPU          CPUInfo // or []CPUInfo to get all the cpu-core's stats?
	Cgroups      []*Cgroup
}

Jump to

Keyboard shortcuts

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