Documentation
¶
Index ¶
- func GetShortID(dockerID string) (string, error)
- type BlkioStatEntry
- type BlkioStats
- type Cgroups
- type ContainerData
- type CpuSetStats
- type CpuStats
- type CpuUsage
- type DockerClient
- func (dc *DockerClient) FindCgroupMountpoint(procfs string, subsystem string) (string, error)
- func (dc *DockerClient) FindControllerMountpoint(subsystem, pid, procfs string) (string, error)
- func (dc *DockerClient) GetDockerParams(params ...string) (map[string]string, error)
- func (dc *DockerClient) InspectContainer(id string) (*docker.Container, error)
- func (dc *DockerClient) ListContainersAsMap() (map[string]*ContainerData, error)
- type DockerClientInterface
- type FilesystemInterface
- type GetStatOpt
- type HugetlbStats
- type MemoryData
- type MemoryStats
- type NetworkInterface
- type PidsStats
- type Specification
- type StatGetter
- type Statistics
- type TcpInterface
- type TcpStat
- type ThrottlingData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetShortID ¶
GetShortID returns short container ID (12 chars)
Types ¶
type BlkioStatEntry ¶
type BlkioStats ¶
type BlkioStats struct { // number of bytes tranferred to and from the block device IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive,omitempty"` IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive,omitempty"` IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive,omitempty"` IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive,omitempty"` IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive,omitempty"` IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive,omitempty"` IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive,omitempty"` SectorsRecursive []BlkioStatEntry `json:"sectors_recursive,omitempty"` }
type Cgroups ¶
type Cgroups struct { CpuStats CpuStats `json:"cpu_stats,omitempty"` MemoryStats MemoryStats `json:"memory_stats,omitempty"` BlkioStats BlkioStats `json:"blkio_stats, omitempty"` HugetlbStats map[string]HugetlbStats `json:"hugetlb_stats,omitempty"` PidsStats PidsStats `json:"pids_stats,omitempty"` CpuSetStats CpuSetStats `json:"cpuset_stats,omitempty"` }
type ContainerData ¶
type ContainerData struct { ID string `json:"-"` // Basic info about the container (status, creation time, image name, etc.) Specification Specification `json:"spec,omitempty"` // Container's statistics (cpu usage, memory usage, network stats, etc.) Stats *Statistics `json:"stats,omitempty"` }
type CpuSetStats ¶
type CpuSetStats struct { Cpus string `json:"cpus,omitempty"` Mems string `json:"mems,omitempty"` MemoryMigrate uint64 `json:"memory_migrate,omitempty"` CpuExclusive uint64 `json:"cpu_exclusive,omitempty"` MemoryExclusive uint64 `json:"memory_exclusive,omitempty"` }
CpuSet stores information regarding subsystem assignment of individual CPUs and memory nodes
type CpuStats ¶
type CpuStats struct { CpuUsage CpuUsage `json:"cpu_usage,omitempty"` ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` }
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient holds go-dockerclient instance ready for communication with the server endpoint `unix:///var/run/docker.sock`, cache instance which is used to store output from docker container inspect (to avoid execute inspect request multiply times, it is called only once per container)
func NewDockerClient ¶
func NewDockerClient(endpoint string) (*DockerClient, error)
NewDockerClient returns dockerClient instance ready for communication with the server endpoint `unix:///var/run/docker.sock`
func (*DockerClient) FindCgroupMountpoint ¶
func (dc *DockerClient) FindCgroupMountpoint(procfs string, subsystem string) (string, error)
FindCgroupMountpoint returns cgroup mountpoint of a given subsystem
func (*DockerClient) FindControllerMountpoint ¶
func (dc *DockerClient) FindControllerMountpoint(subsystem, pid, procfs string) (string, error)
FindControllerMountpoint returns mountpoints of a given controller and container PID
func (*DockerClient) GetDockerParams ¶
func (dc *DockerClient) GetDockerParams(params ...string) (map[string]string, error)
GetDockerParam returns given map of parameter/value from running docker engine
func (*DockerClient) InspectContainer ¶
func (dc *DockerClient) InspectContainer(id string) (*docker.Container, error)
InspectContainer returns details information about running container
func (*DockerClient) ListContainersAsMap ¶
func (dc *DockerClient) ListContainersAsMap() (map[string]*ContainerData, error)
ListContainersAsMap returns list of all available docker containers and base information about them (status, uptime, etc.)
type DockerClientInterface ¶
type DockerClientInterface interface { ListContainersAsMap() (map[string]*ContainerData, error) InspectContainer(string) (*docker.Container, error) FindCgroupMountpoint(string, string) (string, error) FindControllerMountpoint(string, string, string) (string, error) GetDockerParams(...string) (map[string]string, error) }
DockerClientInterface provides methods i.a. for interaction with the docker API.
type FilesystemInterface ¶
type FilesystemInterface struct { // The block device name associated with the filesystem Device string `json:"device_name,omitempty"` // Type of the filesystem Type string `json:"type,omitempty"` // Number of bytes that can be consumed on this filesystem Limit uint64 `json:"capacity,omitempty"` // Number of bytes that is consumed on this filesystem Usage uint64 `json:"usage,omitempty"` // Base Usage that is consumed by the container's writable layer BaseUsage uint64 `json:"base_usage,omitempty"` // Number of bytes available for non-root user Available uint64 `json:"available,omitempty"` // Number of available Inodes InodesFree uint64 `json:"inodes_free,omitempty"` // This is the total number of reads completed successfully ReadsCompleted uint64 `json:"reads_completed,omitempty"` // This is the total number of reads merged successfully. This field lets you know how often this was done ReadsMerged uint64 `json:"reads_merged,omitempty"` // This is the total number of sectors read successfully SectorsRead uint64 `json:"sectors_read,omitempty"` // This is the total number of milliseconds spent reading ReadTime uint64 `json:"read_time,omitempty"` // This is the total number of writes completed successfully WritesCompleted uint64 `json:"writes_completed,omitempty"` // This is the total number of writes merged successfully WritesMerged uint64 `json:"writes_merged,omitempty"` // This is the total number of sectors written successfully SectorsWritten uint64 `json:"sectors_written,omitempty"` // This is the total number of milliseconds spent writing WriteTime uint64 `json:"write_time,omitempty"` // Number of I/Os currently in progress IoInProgress uint64 `json:"io_in_progress,omitempty"` // Number of milliseconds spent doing I/Os IoTime uint64 `json:"io_time,omitempty"` // weighted number of milliseconds spent doing I/Os // This field is incremented at each I/O start, I/O completion, I/O // merge, or read of these stats by the number of I/Os in progress // (field 9) times the number of milliseconds spent doing I/O since the // last update of this field. This can provide an easy measure of both // I/O completion time and the backlog that may be accumulating. WeightedIoTime uint64 `json:"weighted_io_time,omitempty"` }
FilesystemInterface holds statistics about filesystem device, capacity, usage, etc.
type GetStatOpt ¶
type GetStatOpt map[string]interface{}
func (GetStatOpt) GetBoolValue ¶
func (opt GetStatOpt) GetBoolValue(key string) (bool, error)
func (GetStatOpt) GetIntValue ¶
func (opt GetStatOpt) GetIntValue(key string) (int, error)
func (GetStatOpt) GetStringValue ¶
func (opt GetStatOpt) GetStringValue(key string) (string, error)
type HugetlbStats ¶
type MemoryData ¶
type MemoryStats ¶
type MemoryStats struct { Cache uint64 `json:"cache,omitempty"` Usage MemoryData `json:"usage,omitempty"` SwapUsage MemoryData `json:"swap_usage,omitempty"` KernelUsage MemoryData `json:"kernel_usage,omitempty"` Stats map[string]uint64 `json:"statistics,omitempty"` }
type NetworkInterface ¶
type NetworkInterface struct { // Name is the name of the network interface. Name string `json:"-"` RxBytes uint64 `json:"rx_bytes,omitempty"` RxPackets uint64 `json:"rx_packets,omitempty"` RxErrors uint64 `json:"rx_errors,omitempty"` RxDropped uint64 `json:"rx_dropped,omitempty"` TxBytes uint64 `json:"tx_bytes,omitempty"` TxPackets uint64 `json:"tx_packets,omitempty"` TxErrors uint64 `json:"tx_errors,omitempty"` TxDropped uint64 `json:"tx_dropped,omitempty"` }
NetworkInterface holds name of network interface and its statistics (rx_bytes, tx_bytes, etc.)
type Specification ¶
type Specification struct { Status string `json:"status,omitempty"` Created string `json:"creation_time,omitempty"` Image string `json:"image_name,omitempty"` SizeRw int64 `json:"size_rw,omitempty"` SizeRootFs int64 `json:"size_root_fs,omitempty"` Labels map[string]string `json:"labels,omitempty"` }
Specification holds docker container specification
type StatGetter ¶
type StatGetter interface {
GetStats(*Statistics, GetStatOpt) error
}
type Statistics ¶
type Statistics struct { Cgroups *Cgroups `json:"cgroups,omitempty"` Network []NetworkInterface `json:"network,omitempty"` Connection TcpInterface `json:"connection,omitempty"` Filesystem map[string]FilesystemInterface `json:"filesystem,omitempty"` }
func NewStatistics ¶
func NewStatistics() *Statistics
NewStatistics returns pointer to initialized Statistics
type TcpInterface ¶
type TcpInterface struct { Tcp TcpStat `json:"tcp,omitempty"` // TCP connection stats (Established, Listen, etc.) Tcp6 TcpStat `json:"tcp6,omitempty"` // TCP6 connection stats (Established, Listen, etc.) }
TcpInterface holds tcp and tcp6 statistics
type TcpStat ¶
type TcpStat struct { //Count of TCP connections in state "Established" Established uint64 `json:"established,omitempty"` //Count of TCP connections in state "Syn_Sent" SynSent uint64 `json:"syn_sent,omitempty"` //Count of TCP connections in state "Syn_Recv" SynRecv uint64 `json:"syn_recv,omitempty"` //Count of TCP connections in state "Fin_Wait1" FinWait1 uint64 `json:"fin_wait1,omitempty"` //Count of TCP connections in state "Fin_Wait2" FinWait2 uint64 `json:"fin_wait2,omitempty"` //Count of TCP connections in state "Time_Wait TimeWait uint64 `json:"time_wait,omitempty"` //Count of TCP connections in state "Close" Close uint64 `json:"close,omitempty"` //Count of TCP connections in state "Close_Wait" CloseWait uint64 `json:"close_wait,omitempty"` //Count of TCP connections in state "Listen_Ack" LastAck uint64 `json:"last_ack,omitempty"` //Count of TCP connections in state "Listen" Listen uint64 `json:"listen,omitempty"` //Count of TCP connections in state "Closing" Closing uint64 `json:"closing,omitempty"` }
TcpStat holds statistics about count of connections in different states