Surveiller_les_performances_des_conteneurs_Docker_avec_cAdvisor__english_

Monitor the performance of Docker containers with cAdvisor

cAdvisor (https://github.com/google/cadvisor) allows to monitor the performance of a container. It displays information on CPU and memory usage. cAdvisor is written in Go. It captures the metrics that the docker stats command returns and aggregates them.

Let’s launch cAdvisor in a Docker container :

docker run \
  -d \
  -v=/:/rootfs:ro \
  -v=/var/run:/var/run:rw \
  -v=/sys:/sys:ro \
  -v=/var/lib/docker/:/var/lib/docker:ro \
  -p=8080:8080 \
  --privileged \
  --name=cadvisor \
  google/cadvisor:latest
Unable to find image 'google/cadvisor:latest' locally
latest: Pulling from google/cadvisor

5c916c92: Pulling fs layer 
5bb65cdf: Pulling fs layer 
Digest: sha256:815386ebbe9a3490f38785ab11bda34ec8dacf4634af77b8912832d4f85dca04
Status: Downloaded newer image for google/cadvisor:latest
f9c03c73404c04bf371fd501e5a9dab999ebddaf18084a91b4aafbf26459d37b

In order to work, we must give cAdvisor access to the necessary resources on the host. To give full access to the host devices, the container must be launched with the --privileged option.

To access cAdvisor, in a Web browser, go to http://0.0.0.0:8080/.

cAdvisor displays the following sections :

  • Overview,
  • Processes,
  • CPU,
  • Memory.

cAdvisor

cAdvisor

cAdvisor

cAdvisor

The summary page

This web page displays the following sections :

  • The Overview section displays gauges to indicate if the resources have reached their limits.
  • The Processes section displays information from the docker ps aux, docker ps and docker top commands in tabular form; to sort the processes, click on the header of the corresponding column. The columns are:
    • User: this is the user who runs the process,
    • PID: this is the ID of the process,
    • PPID: this is the PID of the parent process,
    • Start Time : this is the time the process starts,
    • CPU %: this is the percentage of CPU consumed,
    • MEM %: this is the percentage of RAM consumed,
    • RSS: this is the amount of main memory consumed,
    • Virtual Size: this is the amount of virtual memory consumed,
    • Status: this is the current state of the process (standard Linux status codes),
    • Running Time: this is the process execution time,
    • Command: This is the command executed by the process,
    • Container: this is the container to which the process is attached.
  • The CPU section shows the CPU usage with the columns:
    • Total Usage: this is the aggregate usage of all cores,
    • Usage per Core: this is a breakdown of usage per core,
    • Usage Breakdown: this is the aggregated usage on all cores but distributed between what is used by the kernel and by the user’s processes.
  • The Memory section is divided into two parts :
    • Total Usage: the total amount of memory used by all processes for the host or container: it is equal to Host Memory + Cold Memory;
      • the Hot Memory corresponds to the pages that have been recently affected by the kernel;
      • the Cold Memory corresponds to the page that has not been touched for a certain period of time and which could be claimed if necessary.
    • Usage Breakdown: it gives a visual representation of Total Usage and Hot Memory.
  • The Network section displays :
    • Throughput: shows incoming and outgoing traffic over the last minute;
    • Errors: these are network errors, so this graph should be flat.
  • The Filesystem section shows a breakdown of filesystem usage.
  • The Subcontainers section shows the top CPU usage and the top memory usage.

The container statistics page

At the top of the page is a link to the running containers to view their statistics.

cAdvisor

cAdvisor

The Docker Containers page

At the top of the page there is a link Docker Containers to display statistics about the Docker host.

cAdvisor

This page contains the following sections:

  • The Subcontainers section displays a list of clickable containers. By clicking on the name, cAdvisor displays details on:
    • the isolation (Isolation):
      • CPU: these are the CPU allocations of the container; if there are no resource limits, information about the host CPU is displayed,
      • Memory : these are the memory allocations of the container,
    • usage (Usage):
      • Overview: these are the gauges that allow you to see if you are approaching the resource limits,
      • Processes: these are the processes of the container,
      • CPU: these are the usage graphs of the CPU isolated from the container,
      • Memory: this is the use of the container’s memory.
  • The Driver Status section displays:
    • the basic statistics of the main Docker process,
    • information about the host kernel,
    • the name of the host,
    • the operating system used,
    • the total number of containers and images (the number of images counts each file system as an individual image).
  • The section Images displays the list of Docker images available on the host: Repository, tag, size, image creation date, image ID.

You now know how to obtain a large amount of very useful statistics on Docker containers, allowing you to diagnose problems and optimize container performance.

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×