user2775185
user2775185

Reputation: 1197

container monitoring not enabled by default

We would like to monitor docker container metrics parameters like CPU, network, memory etc. we are following https://docs.docker.com/articles/runmetrics/ and found that monitoring metrics is not enabled by default.

cat /proc/cgroups 
#subsys_name        hierarchy   num_cgroups enabled
cpuset      1        7         1
cpu         2        7         1
cpuacct     3        7         1
memory      4        7         1
devices     5        7         1

As per the documentation we have to enable monitoring by setting up kernel parameters.

Memory Metrics: memory.stat

Memory metrics are found in the "memory" cgroup. Note that the memory control group adds a little overhead, because it does very fine-grained accounting of the memory usage on your host. Therefore, many distros chose to not enable it by default. Generally, to enable it, all you have to do is to add some kernel command-line parameters: cgroup_enable=memory swapaccount=1

Anyone knows how to set kernel parameters in docker container (Dockerfile or docker-compose.yml).

Thanks in Advance.

Upvotes: 0

Views: 745

Answers (1)

Michael
Michael

Reputation: 10474

If your kernel supports cgroup_enable, you would add this at boot time, for instance on an Ubuntu machine:

edit /etc/default/grub.

update GRUB_CMDLINE_LINUX:

GRUB_CMDLINE_LINUX="cgroup_enable=memory"

then run sudo update-grub and reboot

If you are using CoreOS, it is already available.

Upvotes: 2

Related Questions