Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Group = endpoint.Define( "status", "The status summary of a node", endpoint.Area(area.Node), endpoint.Prefix("node/{hostname}"), endpoint.Uses[dispatch.Deps](), endpoint.Tag("status_operations", "Status", "The status summary of a node"), endpoint.CommandNotes("The [status behavior](../../../../../reference/behaviors/node/status/status.md) page tells where the behavior runs, what it is built on and its settings."), endpoint.Doc[types.RowStatus](dispatch.RowStatusDoc), endpoint.Get[GetRequest, StatusGetResponse]("get"). Handle(HandleGet). ID("GetNodeStatus"). Describe("Get the status summary of the host"). Permission("status:read"). Returns("Each target host's result."). Explain("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."). Example("--target web-01", "An Ubuntu host"). Example("--target web-01", "A Mac"). Result("An Ubuntu host, on one host:\n\n```ansi\n$ osapi client node status get --target web-01\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mUPTIME \x1b[0m\x1b[38;2;10;143;176mOS INFO \x1b[0m\x1b[38;2;10;143;176mLOAD AVERAGE \x1b[0m\x1b[38;2;10;143;176mMEMORY \x1b[0m\x1b[38;2;10;143;176mDISKS \x1b[0m\x1b[38;2;10;143;176mERRORS\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mweb-01\x1b[0m 1 day, 2 hours, 5 minutes 93900 ubuntu 24.04 0.32 0.28 0.25 8.0 GB 2.0 GB 4.0 GB / \n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node status get --target _all\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mUPTIME \x1b[0m\x1b[38;2;10;143;176mOS INFO \x1b[0m\x1b[38;2;10;143;176mLOAD AVERAGE \x1b[0m\x1b[38;2;10;143;176mMEMORY \x1b[0m\x1b[38;2;10;143;176mDISKS \x1b[0m\x1b[38;2;10;143;176mERRORS\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mweb-01\x1b[0m 1 day, 2 hours, 5 minutes 93900 ubuntu 24.04 0.32 0.28 0.25 8.0 GB 2.0 GB 4.0 GB / \n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mweb-02\x1b[0m 1 day, 2 hours, 5 minutes 93900 ubuntu 24.04 0.32 0.28 0.25 8.0 GB 2.0 GB 4.0 GB / \n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"disks\": [\n {\n \"free\": 31457280000,\n \"name\": \"/\",\n \"total\": 52428800000,\n \"used\": 20971520000\n }\n ],\n \"hostname\": \"web-01\",\n \"load_average\": {\n \"15min\": 0.25,\n \"1min\": 0.32,\n \"5min\": 0.28\n },\n \"memory\": {\n \"free\": 2147483648,\n \"total\": 8589934592,\n \"used\": 4294967296\n },\n \"name\": \"web-01\",\n \"os_info\": {\n \"distribution\": \"ubuntu\",\n \"version\": \"24.04\"\n },\n \"status\": \"ok\",\n \"uptime\": {\n \"seconds\": 93900,\n \"uptime\": \"1 day, 2 hours, 5 minutes\"\n }\n }\n ]\n}\n```\n\nA Mac, on one host:\n\n```ansi\n$ osapi client node status get --target web-01\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mUPTIME \x1b[0m\x1b[38;2;10;143;176mOS INFO \x1b[0m\x1b[38;2;10;143;176mLOAD AVERAGE \x1b[0m\x1b[38;2;10;143;176mMEMORY \x1b[0m\x1b[38;2;10;143;176mDISKS \x1b[0m\x1b[38;2;10;143;176mERRORS\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mweb-01\x1b[0m 1 day, 2 hours, 5 minutes 93900 darwin 15.5 0.32 0.28 0.25 8.0 GB 2.0 GB 4.0 GB / \n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node status get --target _all\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME \x1b[0m\x1b[38;2;10;143;176mUPTIME \x1b[0m\x1b[38;2;10;143;176mOS INFO \x1b[0m\x1b[38;2;10;143;176mLOAD AVERAGE \x1b[0m\x1b[38;2;10;143;176mMEMORY \x1b[0m\x1b[38;2;10;143;176mDISKS \x1b[0m\x1b[38;2;10;143;176mERRORS\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mweb-01\x1b[0m 1 day, 2 hours, 5 minutes 93900 darwin 15.5 0.32 0.28 0.25 8.0 GB 2.0 GB 4.0 GB / \n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mweb-02\x1b[0m 1 day, 2 hours, 5 minutes 93900 darwin 15.5 0.32 0.28 0.25 8.0 GB 2.0 GB 4.0 GB / \n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"disks\": [\n {\n \"free\": 31457280000,\n \"name\": \"/\",\n \"total\": 52428800000,\n \"used\": 20971520000\n }\n ],\n \"hostname\": \"web-01\",\n \"load_average\": {\n \"15min\": 0.25,\n \"1min\": 0.32,\n \"5min\": 0.28\n },\n \"memory\": {\n \"free\": 2147483648,\n \"total\": 8589934592,\n \"used\": 4294967296\n },\n \"name\": \"web-01\",\n \"os_info\": {\n \"distribution\": \"darwin\",\n \"version\": \"15.5\"\n },\n \"status\": \"ok\",\n \"uptime\": {\n \"seconds\": 93900,\n \"uptime\": \"1 day, 2 hours, 5 minutes\"\n }\n }\n ]\n}\n```"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host does not have what the request names, such as the object of a deploy."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), )
Group is status as an endpoint group, which its spec comes from.
Functions ¶
Types ¶
type GetRequest ¶
type GetRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
}
GetRequest is the request of status get: its target and its input.
type StatusEntry ¶
type StatusEntry struct {
Hostname string `doc:"Hostname of the agent that produced this result." json:"hostname"`
Status types.RowStatus `doc:"The status of the operation for this host." json:"status"`
Name *string `doc:"The hostname of the host, as the hostname command prints it" json:"name,omitempty"`
Uptime *uptime.Entry `doc:"How long the host has run" json:"uptime,omitempty"`
OSInfo *os.Release `doc:"The operating system" json:"os_info,omitempty"`
LoadAverage *load.Averages `doc:"The load averages of the host" json:"load_average,omitempty"`
Memory *memory.Usage `doc:"The memory of the host" json:"memory,omitempty"`
Disks *[]disk.Disk `doc:"Each local filesystem" json:"disks,omitempty"`
Errors *[]string `doc:"Each read that failed, as name: error. The other fields still answer." json:"errors,omitempty"`
Error *string `doc:"Error message if the agent failed." json:"error,omitempty"`
}
StatusEntry is the result of status on one host.
type StatusGetResponse ¶
type StatusGetResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []StatusEntry `json:"results"`
}
StatusGetResponse is each target host's result.
func HandleGet ¶
func HandleGet( ctx context.Context, d dispatch.Deps, in GetRequest, ) (StatusGetResponse, error)
HandleGet runs status get on the target, for the endpoint server.