Status
c.Status calls the API's Status group. The status summary of a node.
Methods
| Method | Returns | Permission | Description |
|---|---|---|---|
Get(ctx, hostname) | *Response[Collection[StatusEntry]] | status:read | Get the status summary of the host. |
Get
func (s *StatusService) Get(
ctx context.Context,
hostname string,
) (*Response[Collection[StatusEntry]], error)
Get the status summary of the host.
Runs the get of the hostname, uptime, os, load, memory and disk behaviors on the host, and answers with each. A read that fails is in errors, as its name and its error, and the other fields still answer.
It sends GET /api/node/{hostname}/status, and needs the permission
status:read.
The examples of the method's definition:
An Ubuntu host, go run status.go get:
resp, err := c.Status.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. |
Disk
| Field | Type | Description |
|---|---|---|
Free | int | The bytes free to use. |
Name | string | Where the filesystem is mounted. |
Total | int | The size of the filesystem in bytes. |
Used | int | The bytes in use. |
Entry
| Field | Type | Description |
|---|---|---|
Seconds | int | How long the host has run, in seconds. |
Uptime | string | How long the host has run, in days, hours and minutes. |
Release
| Field | Type | Description |
|---|---|---|
Distribution | string | The distribution, such as ubuntu, or darwin. |
Version | string | The version of the distribution, such as 24.04. |
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.
StatusEntry
| Field | Type | Description |
|---|---|---|
Disks | []Disk | Each local filesystem. |
Error | string | Error message if the agent failed. |
Errors | []string | Each read that failed, as name: error. The other fields still answer. |
Hostname | string | Hostname of the agent that produced this result. |
LoadAverage | Averages | |
Memory | Usage | |
Name | string | The hostname of the host, as the hostname command prints it. |
OSInfo | Release | |
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. |
Uptime | Entry |
Usage
| Field | Type | Description |
|---|---|---|
Free | int | Free memory in bytes. |
Total | int | Total memory in bytes. |
Used | int | Used memory in bytes: the total less what is available. |
Example
examples/sdk/client/status.go
runs each example of this page. With no argument, it lists them.