dockerevents

package
v0.0.0-...-9cb4a84 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2015 License: MIT, MIT Imports: 4 Imported by: 0

README

go-dockerevents

Utility for monitoring docker events

Project Goal

This is a simple project to enable user to quickly plug and output destination for docker events.

Control behavior by setting the following environment variables

  • DOCKER_HOST and DOCKER_CERT_PATH to connect to docker daemon
  • DOCKER_EVENT_FILTER as a yaml encoded string to filter docker events

DOCKER_EVENT_FILTER should be structued as followed

image:
    ["ubuntu:latest", "quay.io/coreos/etcd:latest"]
status:
    [create, die, destroy]
container:
    [a925b0d4690c]

Fields are options. The filter follows the following order:

  • If the image field is not empty, is the event from this image in the image field?
  • If the status field is not empty, is the event type included in the status field?
  • If the contianer field is not empty, Is the contianer ID of this event in the contianer field?

docker2lambda

docker2lambda provides a packaged solution for shipping docker events to AWS Lambda for additional processing.

Examples such as

  • Shipping the aggregated events to append to a Google Spreadsheet
  • Filter unwanted events by other criteria
  • Ship events to database

docker2kineiss

docker2kineiss behaves much like docker2lambda except events are shipped to AWS Kinesis.

Kinesis is a paid service (no free tier as of current release) and well suited for mass data ingestion from multiple event source.

If you have a cluster of docker containers, this might suit your need. For instance, setup all cluster node to report container events through Kinesis, then process in batches using AWS Lambda setting Kinesis stream as trigger.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultCallBack

func DefaultCallBack(event *Event) interface{}

func EventLoop

func EventLoop(filter *EventFilter, size uint64) (output <-chan *Event)

func NewClient

func NewClient() (cli *docker.Client, err error)

Types

type Event

type Event struct {
	Status string         `json:"status"`
	ID     string         `json:"iden"`
	From   string         `json:"image"`
	Time   int64          `json:"time"`
	Cli    *docker.Client `json:"-"`
}

type EventFilter

type EventFilter struct {
	Image     FilterInfo
	Status    FilterInfo
	Container FilterInfo
}

func ParseEventFilter

func ParseEventFilter(constraints string) *EventFilter

type EventListener

type EventListener struct {
	C   chan *docker.APIEvents
	Cli *docker.Client
	// contains filtered or unexported fields
}

func NewEventListener

func NewEventListener(filter *EventFilter) (event *EventListener, err error)

func (*EventListener) Close

func (event *EventListener) Close()

func (*EventListener) Filter

func (event *EventListener) Filter(ev *docker.APIEvents) bool

type FilterInfo

type FilterInfo map[string]bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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