docker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

README

Docker Provider

This provider fetches all containers with the label prometheus.io/scrape=true.

Configuration

All options can be configured from environment variables:

Name Alternative Name Required Default
FILESD_PROVIDER_DOCKER_HOST DOCKER_HOST Yes unix:///var/run/docker.sock
FILESD_PROVIDER_DOCKER_API_VERSION DOCKER_API_VERSION Yes 1.25
FILESD_PROVIDER_DOCKER_CERT_PATH DOCKER_CERT_PATH No ""
FILESD_PROVIDER_DOCKER_TLS_VERIFY DOCKER_TLS_VERIFY No False

Containers Labels

Name Default Description
prometheus.io/scrape False Define if the container must be scrape
prometheus.io/host Container IP Define the host of the metrics handler
prometheus.io/port 80 Define the port of the metrics handler
prometheus.io/path /metrics Define the path of the metrics handler
prometheus.io/scheme http Define the scheme of the metrics handler

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDockerListFailed Error occurred when docker failed to list containers
	ErrDockerListFailed = errors.New("failed to list containers")
)

Functions

func ContainerJSONObjectToTargetObject

func ContainerJSONObjectToTargetObject(container Container) models.Target

ContainerJSONObjectToTargetObject Convert Container Object to Target Object Add labels to target

Types

type Container

type Container types.ContainerJSON

Container Object to wrap the Docker ContainerJSON Object

func (Container) GetHost

func (c Container) GetHost() string

GetHost Return the IP Addr or Hostname of container Precedence value:

  • From the 'prometheus.io/host' label.
  • From the IP Address field of NetworkSettings struct.
  • From the first IP Address available when loop on Networks map of NetworkSettings struct.

func (Container) GetID

func (c Container) GetID() string

GetID Return a short id

func (Container) GetImage

func (c Container) GetImage() ContainerImage

GetImage compute and return an ContainerImage Object from Container config

func (Container) GetMetricsPath

func (c Container) GetMetricsPath() string

GetMetricsPath Return the port of container Precedence value:

  • From the 'prometheus.io/path' label.
  • Default value: /metrics

func (Container) GetName

func (c Container) GetName() string

GetName Return the name of container

func (Container) GetPort

func (c Container) GetPort() int

GetPort Return the port of container Precedence value:

  • From the 'prometheus.io/port' label.

func (Container) GetScheme

func (c Container) GetScheme() string

GetScheme return the scheme of the metrics path url of Container

type ContainerImage

type ContainerImage struct {
	Name    string
	Version string
}

ContainerImage Object

func (ContainerImage) GetName

func (i ContainerImage) GetName() string

GetName return the image name of Container

func (ContainerImage) GetVersion

func (i ContainerImage) GetVersion() string

GetVersion return the image version of Container

Jump to

Keyboard shortcuts

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