general

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCPULoad

func GetCPULoad(ctx context.Context, cpuLoad *CPULoad, dataChannel chan *CPULoad, refreshRate uint64) error

GetCPULoad updated the CPULoad struct and serves the data to the data channel.

func GetCPURates

func GetCPURates() ([]float64, error)

GetCPURates fetches and returns the current cpu rate

func GlobalStats

func GlobalStats(ctx context.Context, dataChannel chan AggregatedMetrics, refreshRate uint64) error

GlobalStats gets stats about the mem and the CPUs and prints it.

func ServeBattery

func ServeBattery(ctx context.Context, cpuChannel chan AggregatedMetrics) error

ServeBattery serves battery percentage information

func ServeCPURates

func ServeCPURates(ctx context.Context, cpuChannel chan AggregatedMetrics) error

ServeCPURates serves the cpu rates to the cpu channel

func ServeDiskRates

func ServeDiskRates(ctx context.Context, dataChannel chan AggregatedMetrics) error

ServeDiskRates serves the disk rate data to the data channel

func ServeInfo

func ServeInfo(ctx context.Context, cpuChannel chan AggregatedMetrics) error

ServeInfo provides information about the system such as OS info, uptime, boot time, etc.

func ServeMemRates

func ServeMemRates(ctx context.Context, dataChannel chan AggregatedMetrics) error

ServeMemRates serves stats about the memory to the data channel

func ServeNetRates

func ServeNetRates(ctx context.Context, dataChannel chan AggregatedMetrics) error

ServeNetRates serves info about the network to the data channel

func ServeTemperatureRates

func ServeTemperatureRates(ctx context.Context, dataChannel chan AggregatedMetrics) error

ServeTemperatureRates feeds temperature values from input sensors into the data channel Credits to https://github.com/cjbassi/gotop

Types

type AggregatedMetrics

type AggregatedMetrics struct {
	NetStats       map[string][]float64
	FieldSet       string
	CPUStats       []float64
	MemStats       []float64
	DiskStats      [][]string
	TempStats      [][]string
	HostInfo       [][]string
	BatteryPercent int
}

AggregatedMetrics represents global metrics to be consumed.

type CPULoad

type CPULoad struct {
	CPURates [][]string `json:"-"`
	Usr      int        `json:"usr"`
	Nice     int        `json:"nice"`
	Sys      int        `json:"sys"`
	Iowait   int        `json:"iowait"`
	Soft     int        `json:"soft"`
	Steal    int        `json:"steal"`
	Guest    int        `json:"guest"`
	Gnice    int        `json:"gnice"`
	Idle     int        `json:"idle"`
	Irq      int        `json:"irq"`
}

CPULoad type contains info about load on CPU from various sources as well as general stats about the CPU.

func NewCPULoad

func NewCPULoad() *CPULoad

NewCPULoad is a constructor for the CPULoad type.

func (*CPULoad) UpdateCPULoad

func (c *CPULoad) UpdateCPULoad() error

UpdateCPULoad updates fields of the type CPULoad

Jump to

Keyboard shortcuts

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