Skip to main content

Disk

Get the disk usage of target hosts. osapi behavior get --name disk and osapi behavior method get show the same.

Behavior​

Namedisk
DescriptionGet the disk usage of target hosts
Placementnode
Internalno
APIyes
CLIyes
Nextno
Platformslinux, darwin
Sudonone
Runsdf
Writesnone
Keeps stateno
Usesnone
Used bystatus

Methods (1)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
getreadGET/api/node/{hostname}/diskdisk:readGet the disk usage of the host

Types (1)​

NAMEINPUTOUTPUT
getGetInputEntry { disks }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.disk.<method>
Child spansexec df, exec lsblk, exec mount, exec zfs
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputsnone

Method get​

Nameget
Verbread
DescriptionGet the disk usage of the host
DetailReads 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.
HTTPGET
Route/api/node/{hostname}/disk
Permissiondisk:read
Commandosapi client node disk get
Input typeGetInput
Output typeEntry

Input (0)​

None. The method takes no input; its command needs only --target.

Output (1)​

FIELDTYPEDESCRIPTION
disksarrayEach local filesystem

Examples (1)​

EXAMPLEINPUTOUTPUT
A host with one local filesystem(none)disks=[map[free:3.145728e+10 name:/ total:5.24288e+10 used:2.097152e+10]]