Get the operating system of target hosts. osapi behavior get --name os and
osapi behavior method get show the same.
Behavior
| |
|---|
| Name | os |
| Description | Get the operating system of target hosts |
| Placement | node |
| Internal | no |
| API | yes |
| CLI | yes |
| Next | no |
| Platforms | linux, darwin |
| Sudo | none |
| Runs | none |
| Writes | none |
| Keeps state | no |
| Uses | none |
| Used by | status |
Methods (1)
| NAME | VERB | HTTP | ROUTE | PERMISSION | DESCRIPTION |
|---|
| get | read | GET | /api/node/{hostname}/os | os:read | Get the operating system of the host |
Types (1)
| NAME | INPUT | OUTPUT |
|---|
| get | GetInput | Entry { os_info } |
Settings (0)
None. Declare them with behavior.Config.
Telemetry
| |
|---|
| Span | behavior.os.<method> |
| Child spans | exec sw_vers |
| Metrics | osapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total |
| Attributes | osapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed |
| Recorded inputs | none |
Method get
| |
|---|
| Name | get |
| Verb | read |
| Description | Get the operating system of the host |
| Detail | Reads the distribution and its version: the ID and VERSION_ID of /etc/os-release on Linux, and darwin with the ProductVersion of sw_vers on macOS, such as darwin 15.5. |
| HTTP | GET |
| Route | /api/node/{hostname}/os |
| Permission | os:read |
| Command | osapi client node os get |
| Input type | GetInput |
| Output type | Entry |
None. The method takes no input; its command needs only --target.
Output (1)
| FIELD | TYPE | DESCRIPTION |
|---|
| os_info | object | The operating system |
Examples (2)
| EXAMPLE | INPUT | OUTPUT |
|---|
| An Ubuntu host | (none) | os_info=map[distribution:ubuntu version:24.04] |
| A Mac | (none) | os_info=map[distribution:darwin version:15.5] |