load

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package load is the load behavior: the load averages of the host.

Index

Constants

This section is empty.

Variables

View Source
var Behavior = behavior.Register(behavior.Define(
	"load", "Get the load averages of target hosts",
	behavior.Node,
	behavior.API,
	behavior.Area(area.Node),
	behavior.CLI,

	behavior.Platform(behavior.PlatformLinux, newReader),
	behavior.Platform(behavior.PlatformDarwin, newReader),
	behavior.RunsOnPlatform(behavior.PlatformDarwin, "sysctl"),
	behavior.Read("get", Get).
		Describe("Get the load averages of the host").
		Explain("Reads the averages of the run queue over 1, 5 and 15 minutes.").
		Example("A host under a light load", GetInput{},
			Entry{LoadAverage: Averages{One: 0.32, Five: 0.28, Fifteen: 0.25}},
			behavior.Exists("/proc/loadavg", "0.32 0.28 0.25 1/412 12345\n"),
			behavior.Prints("sysctl -n vm.loadavg", "{ 0.32 0.28 0.25 }\n"),
		),
))

Behavior is the load definition.

Functions

This section is empty.

Types

type Averages

type Averages struct {
	One     float64 `json:"1min"  label:"1 min"  doc:"The load average over 1 minute"`
	Five    float64 `json:"5min"  label:"5 min"  doc:"The load average over 5 minutes"`
	Fifteen float64 `json:"15min" label:"15 min" doc:"The load average over 15 minutes"`
}

Averages are the load averages over 1, 5 and 15 minutes.

type Entry

type Entry struct {
	LoadAverage Averages `json:"load_average" doc:"The load averages of the host"`
}

Entry is the host's load averages.

func Get

func Get(
	ctx context.Context,
	p Provider,
	_ GetInput,
) (Entry, error)

Get is the host's load averages.

type GetInput

type GetInput struct{}

GetInput is get's input, which has none.

type Provider

type Provider interface {
	Load(ctx context.Context) (Averages, error)
}

Provider is what each platform implements: the load averages.

Directories

Path Synopsis
Package mocks holds the generated double of the load provider, for the methods' tests.
Package mocks holds the generated double of the load provider, for the methods' tests.

Jump to

Keyboard shortcuts

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