Skip to content
matt maier edited this page Apr 22, 2015 · 6 revisions

Status

Current status (build, version, etc.) of container on Docker Hub

Requirements

google/cadvisor

Usage

Use of this container does require some configuration. Collectd, by its very nature, has fairly target specific configurations. Generally speaking, it is not usually possible to apply one configuration to an entire infrastructure.

Initially, a mounted volume is leveraged to provide the configurations, which reside outside the container. This enables the container to be generic but does require that the configurations themselves are distributed as part of whatever configuration management or orchestration methodology applies (manual, ansible, puppet, chef, salt, etc.)

The mounted volume requirement will switch to an option as configuration support via etcd and consul is added.

The fundamental steps in using the container are as follows:

  1. Clone the repository
  2. Perform site-wide configuration changes
    1. Renaming the examples to be used throughout the infrastructure
    2. Integrating or templating configuration files
  3. Deploy the etc-collectd directory to target hosts
  4. Perform host-specific configuration updates to Collectd, the CAdvisor plugin and optionally the Mesos plugin or any other Collectd plugins to be used.
  5. Start the cadvisor and cadvisor-collectd containers.

Configuration

  1. Collectd required
  2. CAdvisor collector required
  3. Mesos collector optional

Starting

Command line

# if 'etc-collectd' were deployed to /home/vagrant/etc-collectd

sudo docker run --name=cadvisor \
  -v /:/rootfs:ro \
  -v /var/run:/var/run:rw \
  -v /sys:/sys:ro \
  -v /var/lib/docker/:/var/lib/docker:ro \
  -d google/cadvisor:latest

sudo docker run --name=collectd \
  -v /home/vagrant/etc-collectd:/etc/collectd \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -d maier/cadvisor-collectd:latest

Systemd units

The collectd.service and cadvisor.service unit files from this repository can be used as a starting point. Note, modify collectd unit file to ensure the path for etc-collectd points to where the configuration files are actually located. (default is /conf/etc-collectd)

Troubleshooting

  1. shell access
    • CAdvisor docker exec -it cadvisor /bin/sh, busybox based, use opkg-install to add additional packages.
    • Collectd docker exec -it collectd /bin/sh, alipine based, use apk add to add additional packages.
  2. verify docker socket in collectd container
    • docker exec -it collectd /bin/sh
    • apk update && apk add socat
    • echo -e "GET /containers/json HTTP/1.1\r\n" | socat unix-connect:/var/run/docker.sock -
  3. verify cadvisor (from host)
    • curl -s "$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' cadvisor):8080/api/v2.0/machine" | python -m json.tool
  4. list cadvisor /system.slice/subcontainers (from host), useful when editing system_services: list in cadvisor.yaml
    • curl -s "$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' cadvisor):8080/api/v1.3/containers/system.slice" | python -c 'import json,sys,pprint;obj=json.load(sys.stdin);pprint.pprint(obj["subcontainers"]);'
Clone this wiki locally