collector

package
v0.0.0-...-e70e0a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2016 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoNeedToMonitor = errors.New("container is not supposed to be monitored")

ErrNoNeedToMonitor is used to skip containers that shouldn't be monitored by collectd

Functions

This section is empty.

Types

type CollectdWriter

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

CollectdWriter is responsible for writing data to wrapped writer in collectd exec plugin format

func NewCollectdWriter

func NewCollectdWriter(host string, writer io.Writer) CollectdWriter

NewCollectdWriter creates new CollectdWriter with specified hostname and writer

func (CollectdWriter) Write

func (w CollectdWriter) Write(s Stats) error

type Collector

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

Collector is responsible for discovering containers for monitoring and writing stats

func NewCollector

func NewCollector(client *docker.Client, w CollectdWriter, interval int) *Collector

NewCollector creates new Collector with specified docker client, collectd stats writer and stat updating interval

func (*Collector) Run

func (c *Collector) Run(interval int) error

Run stats loop that discovers containers and runs monitoring tasks for them

type Monitor

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

Monitor is responsible for monitoring of a single container (task)

func NewMonitor

func NewMonitor(c MonitorDockerClient, id string, interval int) (*Monitor, error)

NewMonitor creates new monitor with specified docker client, container id and stat updating interval

type MonitorDockerClient

type MonitorDockerClient interface {
	InspectContainer(id string) (*docker.Container, error)
	Stats(opts docker.StatsOptions) error
}

MonitorDockerClient represents restricted interface for docker client that is used in monitor, docker.Client is a subset of this interface

type Stats

type Stats struct {
	App   string
	Task  string
	Stats docker.Stats
}

Stats represents singe stat from docker stats api for specific task

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL