Documentation ¶
Index ¶
- func GetCPULoad(ctx context.Context, cpuLoad *CPULoad, dataChannel chan *CPULoad, ...) error
- func GetCPURates() ([]float64, error)
- func GlobalStats(ctx context.Context, dataChannel chan AggregatedMetrics, refreshRate uint64) error
- func ServeBattery(ctx context.Context, cpuChannel chan AggregatedMetrics) error
- func ServeCPURates(ctx context.Context, cpuChannel chan AggregatedMetrics) error
- func ServeDiskRates(ctx context.Context, dataChannel chan AggregatedMetrics) error
- func ServeInfo(ctx context.Context, cpuChannel chan AggregatedMetrics) error
- func ServeMemRates(ctx context.Context, dataChannel chan AggregatedMetrics) error
- func ServeNetRates(ctx context.Context, dataChannel chan AggregatedMetrics) error
- func ServeTemperatureRates(ctx context.Context, dataChannel chan AggregatedMetrics) error
- type AggregatedMetrics
- type CPULoad
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 ¶
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 (*CPULoad) UpdateCPULoad ¶
UpdateCPULoad updates fields of the type CPULoad