hostutil

package
v1.3.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: MPL-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostInfo

type HostInfo struct {
	// Timestamp returns the timestamp in UTC on the collection time.
	Timestamp time.Time `json:"timestamp"`
	// CPU returns information about the CPU such as family, model, cores, etc.
	CPU []cpu.InfoStat `json:"cpu"`
	// CPUTimes returns statistics on CPU usage represented in Jiffies.
	CPUTimes []cpu.TimesStat `json:"cpu_times"`
	// Disk returns statitics on disk usage for all accessible partitions.
	Disk []*disk.UsageStat `json:"disk"`
	// Host returns general host information such as hostname, platform, uptime,
	// kernel version, etc.
	Host *host.InfoStat `json:"host"`
	// Memory contains statistics about the memory such as total, available, and
	// used memory in number of bytes.
	Memory *mem.VirtualMemoryStat `json:"memory"`
}

HostInfo holds all the information that gets captured on the host. The set of information captured depends on the host operating system. For more information, refer to: https://github.com/shirou/gopsutil#current-status

func CollectHostInfo

func CollectHostInfo() (*HostInfo, error)

CollectHostInfo returns information on the host, which includes general host status, CPU, memory, and disk utilization.

The function does a best-effort capture on the most information possible, continuing on capture errors encountered and appending them to a resulting multierror.Error that gets returned at the end.

type HostInfoError

type HostInfoError struct {
	Type string
	Err  error
}

HostInfoError is a typed error for more convenient error checking.

func (*HostInfoError) Error

func (e *HostInfoError) Error() string

func (*HostInfoError) WrappedErrors

func (e *HostInfoError) WrappedErrors() []error

Jump to

Keyboard shortcuts

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