Get the memory usage of target hosts. osapi behavior get --name memory and
osapi behavior method get show the same.
Behavior
| |
|---|
| Name | memory |
| Description | Get the memory usage 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}/memory | memory:read | Get the memory usage of the host |
Types (1)
| NAME | INPUT | OUTPUT |
|---|
| get | GetInput | Entry { memory } |
Settings (0)
None. Declare them with behavior.Config.
Telemetry
| |
|---|
| Span | behavior.memory.<method> |
| Child spans | exec sysctl, exec vm_stat |
| 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 memory usage of the host |
| Detail | Reads the total, the free and the used memory, in bytes. Used is the total less what is available, which includes the cache, as free(1) reports it. |
| HTTP | GET |
| Route | /api/node/{hostname}/memory |
| Permission | memory:read |
| Command | osapi client node memory get |
| Input type | GetInput |
| Output type | Entry |
None. The method takes no input; its command needs only --target.
Output (1)
| FIELD | TYPE | DESCRIPTION |
|---|
| memory | object | The memory of the host |
Examples (1)
| EXAMPLE | INPUT | OUTPUT |
|---|
| A host with 8 GiB, 2 GiB of it free | (none) | memory=map[free:2.147483648e+09 total:8.589934592e+09 used:4.294967296e+09] |