Load
c.Load calls the API's Load group. Get the load averages of target hosts.
Methods
| Method | Returns | Permission | Description |
|---|---|---|---|
Get(ctx, hostname) | *Response[Collection[LoadEntry]] | load:read | Get 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
| Field | Type | Description |
|---|---|---|
Min15 | float64 | The load average over 15 minutes. |
Min1 | float64 | The load average over 1 minute. |
Min5 | float64 | The load average over 5 minutes. |
LoadEntry
| Field | Type | Description |
|---|---|---|
Error | string | Error message if the agent failed. |
Hostname | string | Hostname of the agent that produced this result. |
LoadAverage | Averages | |
Status | 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. |
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.