cadvisor: github.com/google/cadvisor/container/common Index | Files

package common

import "github.com/google/cadvisor/container/common"

Unmarshal's a Containers description json file. The json file contains an array of ContainerHint structs, each with a container's id and networkInterface This allows collecting stats about network interfaces configured outside docker and lxc

Handler for Docker containers.

Index

Package Files

container_hints.go fsHandler.go helpers.go inotify_watcher.go

Constants

const DefaultPeriod = time.Minute

Variables

var ArgContainerHints = flag.String("container_hints", "/etc/cadvisor/container_hints.json", "location of the container hints file")

func AssignDeviceNamesToDiskStats Uses

func AssignDeviceNamesToDiskStats(namer DeviceNamer, stats *info.DiskIoStats)

AssignDeviceNamesToDiskStats assigns the Device field on the provided DiskIoStats by looking up the device major and minor identifiers in the provided device namer.

func CgroupExists Uses

func CgroupExists(cgroupPaths map[string]string) bool

func DebugInfo Uses

func DebugInfo(watches map[string][]string) map[string][]string

func GetSpec Uses

func GetSpec(cgroupPaths map[string]string, machineInfoFactory info.MachineInfoFactory, hasNetwork, hasFilesystem bool) (info.ContainerSpec, error)

func ListContainers Uses

func ListContainers(name string, cgroupPaths map[string]string, listType container.ListType) ([]info.ContainerReference, error)

func ListDirectories Uses

func ListDirectories(dirpath string, parent string, recursive bool, output map[string]struct{}) error

Lists all directories under "path" and outputs the results as children of "parent".

func MakeCgroupPaths Uses

func MakeCgroupPaths(mountPoints map[string]string, name string) map[string]string

type ContainerHints Uses

type ContainerHints struct {
    AllHosts []containerHint `json:"all_hosts,omitempty"`
}

func GetContainerHintsFromFile Uses

func GetContainerHintsFromFile(containerHintsFile string) (ContainerHints, error)

type DeviceNamer Uses

type DeviceNamer interface {
    // DeviceName returns the name of the device by its major and minor ids, or false if no
    // such device is recognized.
    DeviceName(major, minor uint64) (string, bool)
}

DeviceNamer returns string names for devices by their major and minor id.

type FsHandler Uses

type FsHandler interface {
    Start()
    Usage() FsUsage
    Stop()
}

func NewFsHandler Uses

func NewFsHandler(period time.Duration, rootfs, extraDir string, fsInfo fs.FsInfo) FsHandler

type FsUsage Uses

type FsUsage struct {
    BaseUsageBytes  uint64
    TotalUsageBytes uint64
    InodeUsage      uint64
}

type InotifyWatcher Uses

type InotifyWatcher struct {
    // contains filtered or unexported fields
}

Watcher for container-related inotify events in the cgroup hierarchy.

Implementation is thread-safe.

func NewInotifyWatcher Uses

func NewInotifyWatcher() (*InotifyWatcher, error)

func (*InotifyWatcher) AddWatch Uses

func (iw *InotifyWatcher) AddWatch(containerName, dir string) (bool, error)

Add a watch to the specified directory. Returns if the container was already being watched.

func (*InotifyWatcher) Close Uses

func (iw *InotifyWatcher) Close() error

Closes the inotify watcher.

func (*InotifyWatcher) Error Uses

func (iw *InotifyWatcher) Error() chan error

Errors are returned on this channel.

func (*InotifyWatcher) Event Uses

func (iw *InotifyWatcher) Event() chan *inotify.Event

Events are returned on this channel.

func (*InotifyWatcher) GetWatches Uses

func (iw *InotifyWatcher) GetWatches() map[string][]string

Returns a map of containers to the cgroup paths being watched.

func (*InotifyWatcher) RemoveWatch Uses

func (iw *InotifyWatcher) RemoveWatch(containerName, dir string) (bool, error)

Remove watch from the specified directory. Returns if this was the last watch on the specified container.

type MachineInfoNamer Uses

type MachineInfoNamer info.MachineInfo

func (*MachineInfoNamer) DeviceName Uses

func (n *MachineInfoNamer) DeviceName(major, minor uint64) (string, bool)

type Mount Uses

type Mount struct {
    HostDir      string `json:"host_dir,omitempty"`
    ContainerDir string `json:"container_dir,omitempty"`
}

Package common imports 20 packages (graph) and is imported by 325 packages. Updated 2020-04-29. Refresh now. Tools for package owners.