-
Notifications
You must be signed in to change notification settings - Fork 6
Home
Current status (build, version, etc.) of container on Docker Hub
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:
- Clone the repository
- Perform site-wide configuration changes
- Renaming the examples to be used throughout the infrastructure
- Integrating or templating configuration files
- Deploy the
etc-collectd
directory to target hosts - Perform host-specific configuration updates to Collectd, the CAdvisor plugin and optionally the Mesos plugin or any other Collectd plugins to be used.
- Start the cadvisor and cadvisor-collectd containers.
- Collectd required
- CAdvisor collector required
- Mesos collector optional
# 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
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
)
- shell access
- CAdvisor
docker exec -it cadvisor /bin/sh
, busybox based, useopkg-install
to add additional packages. - Collectd
docker exec -it collectd /bin/sh
, alipine based, useapk add
to add additional packages.
- CAdvisor
- 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 -
- verify cadvisor (from host)
curl -s "$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' cadvisor):8080/api/v2.0/machine" | python -m json.tool
- list cadvisor /system.slice/subcontainers (from host), useful when editing
system_services:
list incadvisor.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"]);'