Use Google cAdvisor for monitoring your containers + Docker tutorial
If you’re looking for tool to understand the resource usage and performance characteristics of the running containers then cAdvisor (Container Advisor) is the perfect tool that provides container metrics.It is a running daemon that collects, aggregates, processes, and exports information about running containers. Specifically, for each container it keeps resource isolation parameters, historical resource usage, histograms of complete historical resource usage and network statistics. This data is exported by container and machine-wide.
- cAdvisor is an open-source container resource usage collector.
- Native support for Docker containers and just support other container types.
- cAdvisor operates per node. It auto-discovers all containers in the given node and collects CPU, memory, filesystem, and network usage statistics.
- Support for running standalone outside of Docker or any other container.
- Provides the overall machine usage by analyzing the ‘root’ container on the machine.
- Supports exporting stats to various storage plugins ex.Elasticsearch,InfluxDB etc.,
- Metrics can be viewed on Web-UI
/containerswhich exports live information about all containers on the machine.
- Exposes raw and processed stats via a versioned remote REST API
- Collects basic resource utilization i.e., we would not be able to get how the container applications are actually performing, for example, x% CPU utilization
- Doesn’t offer any long term storage, trending, or analysis capabilities.
Quick Start: Run cAdvisor with Docker Container
google/cadvisor includes everything that you need to get started
docker run \ --volume=/:/rootfs:ro \ --volume=/var/run:/var/run:rw \ --volume=/sys:/sys:ro \ --volume=/var/lib/docker/:/var/lib/docker:ro \ --volume=/dev/disk/:/dev/disk:ro \ --publish=8080:8080 \ --detach=true \ --name=cadvisor \ google/cadvisor:latest
cAdvisor would now be running on
|Metric name||Type||Description||Unit (where applicable)|
|Gauge||Percent of time over the past sample period during which the accelerator was actively processing||percentage|
|Gauge||Total accelerator memory||bytes|
|Gauge||Total accelerator memory allocated||bytes|
|Counter||Number of elapsed enforcement period intervals|
|Counter||Number of throttled period intervals|
|Counter||Total time duration the container has been throttled||seconds|
|Gauge||Value of container CPU load average over the last 10 seconds|
|Counter||Number of times processes of the cgroup have run on the CPU|
|Counter||Time duration the processes of the container have run on the CPU||seconds|
|Counter||Time duration processes of the container have been waiting on a runqueue||seconds|
|Counter||Cumulative system CPU time consumed||seconds|
|Counter||Cumulative CPU time consumed||seconds|
|Counter||Cumulative user CPU time consumed||seconds|
|Gauge||Number of available Inodes|
|Gauge||Total number of Inodes|
|Gauge||Number of I/Os currently in progress|
|Counter||Cumulative count of seconds spent doing I/Os||seconds|
|Counter||Cumulative weighted I/O time||seconds|
|Gauge||Number of bytes that can be consumed by the container on this filesystem||bytes|
|Counter||Cumulative count of bytes read||bytes|
|Counter||Cumulative count of reads completed|
|Counter||Cumulative count of seconds spent reading|
|Counter||Cumulative count of reads merged|
|Counter||Cumulative count of sector reads completed|
|Counter||Cumulative count of sector writes completed|
|Gauge||Number of bytes that are consumed by the container on this filesystem||bytes|
|Counter||Cumulative count of seconds spent writing||seconds|
|Counter||Cumulative count of bytes written||bytes|
|Counter||Cumulative count of writes merged|
|Counter||Cumulative count of writes completed|
|Gauge||Last time a container was seen by the exporter||timestamp|
|Gauge||Total page cache memory||bytes|
|Counter||Number of memory usage hits limits|
|Counter||Cumulative count of memory allocation failures|
|Gauge||Maximum memory usage recorded||bytes|
|Gauge||Size of RSS||bytes|
|Gauge||Container swap usage||bytes|
|Gauge||Current memory usage, including all memory regardless of when it was accessed||bytes|
|Gauge||Current working set||bytes|
|Counter||Cumulative count of bytes received||bytes|
|Counter||Cumulative count of packets dropped while receiving|
|Counter||Cumulative count of packets received|
|Counter||Cumulative count of errors encountered while receiving|
|Counter||Cumulative count of bytes transmitted||bytes|
|Counter||Cumulative count of packets transmitted|
|Counter||Cumulative count of packets dropped while transmitting|
|Counter||Cumulative count of errors encountered while transmitting|
|Gauge||TCP connection usage statistic for container|
|Gauge||UDP connection usage statistic for container|
|Gauge||CPU period of the container|
|Gauge||CPU quota of the container|
|Gauge||CPU share of the container|
|Gauge||Memory limit for the container||bytes|
|Gauge||Memory swap limit for the container||bytes|
|Gauge||Memory reservation limit for the container||bytes|
|Gauge||Start time of the container since UNIX epoch||seconds|
|Gauge||Number of tasks in the given state (|
Like this post? Don’t forget to share it!
- Runtime Options
- Prometheus Tutorial
- TOP 6 GUI tools for managing Docker environments
- Docker tutorial – Build Docker image for your Java application
- How to aggregate Docker Container logs and analyse with ELK stack ?
- Implementing secure containers using gVisor+Docker tutorial
Also published on Medium.