collect docker stats from mesos and transmit them to influxdb
500K+
This is a docker image to collect resource usage from docker
containers. Resource usage collected from docker stats API and sent to
influxdb installation. Containers can be added and removed on the fly, no need
to restart the service.
Based on work from @bobrik https://github.com/bobrik/collectd-docker with following enhancements:
This plugin treats containers as tasks that run as parts of apps.
Set the label app_id directly on the container
Set collectd_docker_app_label on the container that points to which actual
label to use. e.g.collectd_docker_app_label=app_id will use app_id label on the
container
Set environment variable MARATHON_APP_ID on the container
Set COLLECTD_DOCKER_APP_ENV on the container that points to which actual
environment variable to use. For example, marathon sets MARATHON_APP_ID and
by setting COLLECTD_DOCKER_APP_ENV to MARATHON_APP_ID you would get the
marathon app id.
These keys can be changed globally by setting APP_LABEL_KEY or APP_ENV_KEY
when running the collectd container. For example, if you set APP_ENV_KEY to
MARATHON_APP_ID on the collectd container, then this will use
MARATHON_APP_ID on all running containers.
collectd_docker_task directly on the containercollectd_docker_task_label on the container that points to which actual
label to use. e.g.collectd_docker_task_label=task_id will use task_id label on the
containerCOLLECTD_DOCKER_TASK on the containerCOLLECTD_DOCKER_TASK_ENV on the container that points to which actual
environment variable to use. For example, mesos sets MESOS_TASK_ID and by
setting COLLECTD_DOCKER_TASK_ENV to MESOS_TASK_ID you would get the mesos
task id.These keys can be changed globally by setting TASK_LABEL_KEY or TASK_ENV_KEY
when running the collectd container. For example, if you set TASK_ENV_KEY to
MESOS_TASK_ID on the collectd container, then this will use MESOS_TASK_ID on
all running containers.
Influxdb table is created with a table per measurement type, and a column per gauge
Gauges:
CPU (cpu table)
usersystemtotalMemory overview (memory table)
limitmaxusageMemory breakdown (memory table)
active_anonactive_filecacheinactive_anoninactive_filemapped_filepg_faultpg_inpg_outrssrss_hugeunevictablewritebackNetwork (bridge mode only)
rx_bytesrx_droppedrx_errorsrx_packetstx_bytestx_droppedtx_errorstx_packetsGrafana 2 dashboard is included.

Minimal command:
docker run -d -v /var/run/docker.sock:/var/run/docker.sock \
-e INFLUXDB_URL=<influxdb url> \
forestscribe/collectd-docker
COLLECT_INTERVAL - metric update interval in seconds, defaults to 10.INFLUXDB_URL - influxdb database where carbon is listening for data.INFLUXDB_DATABASE - influxdb database (will be created if inexistent).INFLUXDB_USERNAME - influxdb username for that database.INFLUXDB_PASSWORD - influxdb password for that database.APP_LABEL_KEY - container label to use for app name, collectd_docker_app by default.APP_ENV_KEY - container environment variable to use for app name, MARATHON_APP_ID by default.TASK_LABEL_KEY - container label to use for task name, collectd_docker_task by default.TASK_ENV_KEY - container environment variable to use for task name, MESOS_TASK_ID by default.Note that this docker image is very minimal and libc inside does not support
search directive in /etc/resolv.conf. You have to supply full hostname in
GRAPHITE_HOST that can be resolved with nameserver.
MIT
Content type
Image
Digest
Size
8.4 MB
Last updated
over 9 years ago
docker pull forestscribe/influxdb-docker-collect