Documentation
¶
Overview ¶
Package disk is the disk behavior: the usage of the host's local filesystems.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Behavior = behavior.Register(behavior.Define( "disk", "Get the disk usage of target hosts", behavior.Node, behavior.API, behavior.Area(area.Hardware), behavior.CLI, behavior.Platform(behavior.PlatformLinux, newReader), behavior.Platform(behavior.PlatformDarwin, newReader), behavior.Runs("df"), behavior.RunsOnPlatform(behavior.PlatformLinux, "lsblk"), behavior.RunsOnPlatform(behavior.PlatformDarwin, "mount"), behavior.RunsIfPresent("zfs"), behavior.Read("get", Get). Describe("Get the disk usage of the host"). Explain("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."). Example("A host with one local filesystem", GetInput{}, Entry{ Disks: []Disk{ {Name: "/", Total: 52428800000, Used: 20971520000, Free: 31457280000}, }, }, behavior.Exists("/proc/mounts", "/dev/sda1 / ext4 rw,relatime 0 0\ntmpfs /run tmpfs rw 0 0\n"), behavior.Prints("df -akP", "Filesystem 1024-blocks Used Available Capacity Mounted on\n"+ "/dev/sda1 51200000 20480000 30720000 40% /\n"+ "tmpfs 1024 0 1024 0% /run\n"), behavior.Prints("mount", "/dev/disk3s1 on / (apfs, local, journaled)\n"+ "devfs on /dev (devfs, local, nobrowse)\n"), behavior.Prints("df -ki", "Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on\n"+ "/dev/disk3s1 51200000 20480000 30720000 40% 100 200 1% /\n"), ), ))
Behavior is the disk definition.
Functions ¶
This section is empty.
Types ¶
type Disk ¶
type Disk struct {
Name string `json:"name" doc:"Where the filesystem is mounted"`
Total int `json:"total" doc:"The size of the filesystem in bytes" render:"bytes"`
Used int `json:"used" doc:"The bytes in use" render:"bytes"`
Free int `json:"free" doc:"The bytes free to use" render:"bytes"`
}
Disk is one mounted filesystem and its usage, in bytes.
Click to show internal directories.
Click to hide internal directories.