Get the disk usage of target hosts. osapi behavior get --name disk and
osapi behavior method get show the same.
Behavior
| |
|---|
| Name | disk |
| Description | Get the disk usage of target hosts |
| Placement | node |
| Internal | no |
| API | yes |
| CLI | yes |
| Next | no |
| Platforms | linux, darwin |
| Sudo | none |
| Runs | df |
| Writes | none |
| Keeps state | no |
| Uses | none |
| Used by | status |
Methods (1)
| NAME | VERB | HTTP | ROUTE | PERMISSION | DESCRIPTION |
|---|
| get | read | GET | /api/node/{hostname}/disk | disk:read | Get the disk usage of the host |
Types (1)
| NAME | INPUT | OUTPUT |
|---|
| get | GetInput | Entry { disks } |
Settings (0)
None. Declare them with behavior.Config.
Telemetry
| |
|---|
| Span | behavior.disk.<method> |
| Child spans | exec df, exec lsblk, exec mount, exec zfs |
| 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 disk usage of the host |
| Detail | Reads the size, the used space and the free space of each local filesystem, in bytes: the mounts of /proc/mounts on Linux and of mount on macOS, with their sizes from df. Local is ext4, xfs and btrfs on Linux, and apfs and hfs on macOS. Network and special filesystems are left out. |
| HTTP | GET |
| Route | /api/node/{hostname}/disk |
| Permission | disk:read |
| Command | osapi client node disk get |
| Input type | GetInput |
| Output type | Entry |
None. The method takes no input; its command needs only --target.
Output (1)
| FIELD | TYPE | DESCRIPTION |
|---|
| disks | array | Each local filesystem |
Examples (1)
| EXAMPLE | INPUT | OUTPUT |
|---|
| A host with one local filesystem | (none) | disks=[map[free:3.145728e+10 name:/ total:5.24288e+10 used:2.097152e+10]] |