Skip to main content

Load

c.Load calls the API's Load group. Get the load averages of target hosts.

Methods​

MethodReturnsPermissionDescription
Get(ctx, hostname)*Response[Collection[LoadEntry]]load:readGet the load averages of the host.

Get​

func (s *LoadService) Get(
ctx context.Context,
hostname string,
) (*Response[Collection[LoadEntry]], error)

Get the load averages of the host.

Reads the averages of the run queue over 1, 5 and 15 minutes.

It sends GET /api/node/{hostname}/load, and needs the permission load:read.

The examples of the method's definition:

A host under a light load, go run load.go get:

resp, err := c.Load.Get(ctx, target)

Types​

The fields of each type are the properties of its schema in the API's spec.

Averages​

FieldTypeDescription
Min15float64The load average over 15 minutes.
Min1float64The load average over 1 minute.
Min5float64The load average over 5 minutes.

LoadEntry​

FieldTypeDescription
ErrorstringError message if the agent failed.
HostnamestringHostname of the agent that produced this result.
LoadAverageAverages
StatusRowStatusWhat happened on the host: ok, the operation ran and succeeded; failed, it ran and did not succeed; skipped, the host's OS family does not support it; timeout, the host did not answer, so nobody knows whether it ran.

RowStatus​

What happened on the host: ok, the operation ran and succeeded; failed, it ran and did not succeed; skipped, the host's OS family does not support it; timeout, the host did not answer, so nobody knows whether it ran.

A string, one of ok, failed, skipped, timeout.

Example​

examples/sdk/client/load.go runs each example of this page. With no argument, it lists them.