Documentation
¶
Overview ¶
Package host reads the resource usage of the Linux machine shed runs on from procfs, sysfs, and statfs.
Counters are cumulative since boot; callers turn two readings into rates. Network and disk I/O only count physical devices, those with a device link in sysfs, so that traffic through Docker's bridges and veth pairs, loop devices, and device-mapper volumes is not counted twice.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// Path is a path on the filesystem whose usage is reported; empty
// means /.
Path string
// Proc and Sys are the procfs and sysfs mount points; empty means
// /proc and /sys.
Proc, Sys string
}
Reader reads host stats. The zero value reads /proc and /sys and reports the filesystem of /.
type Stats ¶
type Stats struct {
// CPUs is the number of online CPUs.
CPUs int
// CPUTotal and CPUIdle are the cumulative time of all CPUs, and the
// part of it spent idle or waiting for I/O, in clock ticks.
CPUTotal, CPUIdle uint64
// MemoryTotal and MemoryAvailable are in bytes. Available memory
// includes reclaimable page cache.
MemoryTotal, MemoryAvailable uint64
// NetRx and NetTx are cumulative bytes over physical network interfaces.
NetRx, NetTx uint64
// DiskRead and DiskWrite are cumulative bytes over physical disks.
DiskRead, DiskWrite uint64
// DiskTotal and DiskUsed are the size and used bytes of the filesystem
// holding the reader's path.
DiskTotal, DiskUsed uint64
}
Stats is one reading of the host's resource usage.
Click to show internal directories.
Click to hide internal directories.