Documentation
¶
Overview ¶
Package crunchstat reports resource usage (CPU, memory, disk, network) for a cgroup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reporter ¶
type Reporter struct { // CID of the container to monitor. If empty, read the CID // from CIDFile (first waiting until a non-empty file appears // at CIDFile). If CIDFile is also empty, report host // statistics. CID string // Path to a file we can read CID from. CIDFile string // Where cgroup accounting files live on this system, e.g., // "/sys/fs/cgroup". CgroupRoot string // Parent cgroup, e.g., "docker". CgroupParent string // Interval between samples. Must be positive. PollPeriod time.Duration // Temporary directory, will be monitored for available, used & total space. TempDir string // Where to write statistics. Must not be nil. Logger *log.Logger // contains filtered or unexported fields }
A Reporter gathers statistics for a cgroup and writes them to a log.Logger.
func (*Reporter) Start ¶
func (r *Reporter) Start()
Start starts monitoring in a new goroutine, and returns immediately.
The monitoring goroutine waits for a non-empty CIDFile to appear (unless CID is non-empty). Then it waits for the accounting files to appear for the monitored container. Then it collects and reports statistics until Stop is called.
Callers should not call Start more than once.
Callers should not modify public data fields after calling Start.
Click to show internal directories.
Click to hide internal directories.