# Metricbeat - Docker Container stats in Mesos DCOS

**URL:** <https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131>\
**Category:** Beats\
**Created:** [August 23, 2017, 8:56pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131 "2017-08-23T20:56:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jruzicka](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@jruzicka](https://discuss.elastic.co/u/jruzicka)\
**Post date:** [August 23, 2017, 8:56pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131/1 "2017-08-23T20:56:34Z")

</div>

Does anyone have best practice for sending Elastic Docker stats from containers running in DCOS on CentOS? I'm running Elastic 5.2.2. I see some discussion with using filebeat, but i'm interested in the cpu & mem usage of each container and think I should be using metricbeat instead. Anyone accomplish this and/or have specific guidance to accomplish this? Any info would be much appreciated.

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [August 25, 2017, 2:50pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131/2 "2017-08-25T14:50:54Z")

</div>

Hi @jruzicka,

You may want to have a look to Metricbeat Docker module: [https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-docker.html](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-docker.html), it can retrieve the info you want from Docker.

Also check [https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html](https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html) on how to run metricbeat on top of Docker.

Ideally you would launch a metricbeat container per host, so it can monitor all local containers

---

<div class="post-metadata">

**Author:** ![jruzicka](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@jruzicka](https://discuss.elastic.co/u/jruzicka)\
**Post date:** [August 25, 2017, 3:40pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131/3 "2017-08-25T15:40:59Z")

</div>

Thank you. I was able to get metricbeat running on one of our agents in a DCOS cluster. Are you familiar with DCOS and container metrics? For instance I believe I see cgroup system.process.cgroup.memory.mem.usage.bytes on container tasks that contradict docker stats memory values as well as contradicts the mem setting that was allocated to the dcos service.

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [August 25, 2017, 4:14pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131/4 "2017-08-25T16:14:43Z")

</div>

Could you please elaborate? It would be useful if you share the exact metrics & values that seem wrong

---

<div class="post-metadata">

**Author:** ![jruzicka](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@jruzicka](https://discuss.elastic.co/u/jruzicka)\
**Post date:** [August 25, 2017, 5:25pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131/5 "2017-08-25T17:25:58Z")

</div>

Sure thing. Thanks for looking into this. I am running DCOS 1.9.2, Elastic 5.2.2

When running "docker stats" on the private agent it returns a number of containers this is one for example:  
CONTAINER CPU % MEM USAGE / LIMIT NAME  
9bf5e111541f 0.06% 253.8 MiB / 256 MiB mesos-9e706938-\*\*\*\*\*\*\*

I then went into DCOS and reviewed the stdout files for each Docker task running and identified the specific dcos service container that the above mesos-\* name value represents. DCOS has 256MiB set for this service. So I was thinking this looks good.

The next step is what I'm not so sure about.  
I put a metricbeat on the same private node. The metricbeat.yml is pretty simple it is:

-module: system  
metricsets: [process]  
cgroups: true  
enabled: true  
period: 30s  
processes: ['.\*']

I found this at: [https://www.elastic.co/blog/monitoring\_container\_resource\_usage\_with\_metricbeat](https://www.elastic.co/blog/monitoring_container_resource_usage_with_metricbeat)

This sends a lot of information into Elastic and I only ran it for a minute.

In Kibana I queried to find the [system.process.name](http://system.process.name) = "docker" and excluded other [process.name](http://process.name)'s that might have docker in the value such as: "mesos-docker-ex" and "docker-proxy" and "docker-containe"

The resulting docs I was able to find the service i'm interested in in the field: system.process.cmdline. On this same doc the field: system.process.cgroup.memory.mem.usage.bytes has the value: 538,157,056

I was expecting to see 253.8MB as shown in docker stats. Maybe i'm not understanding the cgroup values correctly.

I found this post which makes me think there might be an issue with DCOS memory limits on Docker containers.  
[https://jira.mesosphere.com/browse/DCOS\_OSS-1501](https://jira.mesosphere.com/browse/DCOS_OSS-1501)

I also read that Docker will take more memory then allocated if you do not specify a memory max in your docker-compose.yml - which I have not.

Any information would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [August 29, 2017, 3:00pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131/6 "2017-08-29T15:00:11Z")

</div>

I think it's better if you use docker `memory` metricset, [https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-docker.html](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-docker.html) like:

```auto
- module: docker
  metricsets:
    - memory

```

Check this for a list of fields you should get: [https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-metricset-docker-memory.html](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-metricset-docker-memory.html)

---

<div class="post-metadata">

**Author:** ![jruzicka](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@jruzicka](https://discuss.elastic.co/u/jruzicka)\
**Post date:** [August 30, 2017, 2:12pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131/7 "2017-08-30T14:12:28Z")

</div>

Thank you, I have this working as you recommended. I feel like with metricbeat I can get just as much detail as I can with DockBeat. Is there some benefit of Dockbeat that maybe i'm missing? [https://github.com/Ingensi/dockbeat](https://github.com/Ingensi/dockbeat)

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [August 30, 2017, 2:38pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131/8 "2017-08-30T14:38:34Z")

</div>

I haven't used Dockbeat but from what I see in [https://github.com/Ingensi/dockbeat/blob/develop/docs/fields.asciidoc](https://github.com/Ingensi/dockbeat/blob/develop/docs/fields.asciidoc) I think most of it is already covered by Metricbeat

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 13, 2017, 8:56pm UTC](https://discuss.elastic.co/t/metricbeat-docker-container-stats-in-mesos-dcos/98131/9 "2017-09-13T20:56:58Z")

</div>

This topic was automatically closed after 21 days. New replies are no longer allowed.
