Docker

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 (Container Advisor)
Image – cAdvisor (Container Advisor)

This quickstart assumes basic understanding of Docker concepts, please refer earlier posts for understanding on Docker & how to install and containerize applications.

Key Features

  • 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 /containers which exports live information about all containers on the machine.
  • Exposes raw and processed stats via a versioned remote REST API

Limitations

  • 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

Docker image 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
Run cAdvisor Docker container
Image – Run cAdvisor Docker container

cAdvisor would now be running on http://localhost:8080

cAdvisor Metrics (1)
Image – cAdvisor Metrics (1)

 

cAdvisor Metrics (2)
Image – cAdvisor Metrics (2)

cAdvisor Metrics

Metric name Type Description Unit (where applicable)
container_accelerator_duty_cycle Gauge Percent of time over the past sample period during which the accelerator was actively processing percentage
container_accelerator_memory_total_bytes Gauge Total accelerator memory bytes
container_accelerator_memory_used_bytes Gauge Total accelerator memory allocated bytes
container_cpu_cfs_periods_total Counter Number of elapsed enforcement period intervals
container_cpu_cfs_throttled_periods_total Counter Number of throttled period intervals
container_cpu_cfs_throttled_seconds_total Counter Total time duration the container has been throttled seconds
container_cpu_load_average_10s Gauge Value of container CPU load average over the last 10 seconds
container_cpu_schedstat_run_periods_total Counter Number of times processes of the cgroup have run on the CPU
container_cpu_schedstat_run_seconds_total Counter Time duration the processes of the container have run on the CPU seconds
container_cpu_schedstat_runqueue_seconds_total Counter Time duration processes of the container have been waiting on a runqueue seconds
container_cpu_system_seconds_total Counter Cumulative system CPU time consumed seconds
container_cpu_usage_seconds_total Counter Cumulative CPU time consumed seconds
container_cpu_user_seconds_total Counter Cumulative user CPU time consumed seconds
container_fs_inodes_free Gauge Number of available Inodes
container_fs_inodes_total Gauge Total number of Inodes
container_fs_io_current Gauge Number of I/Os currently in progress
container_fs_io_time_seconds_total Counter Cumulative count of seconds spent doing I/Os seconds
container_fs_io_time_weighted_seconds_total Counter Cumulative weighted I/O time seconds
container_fs_limit_bytes Gauge Number of bytes that can be consumed by the container on this filesystem bytes
container_fs_reads_bytes_total Counter Cumulative count of bytes read bytes
container_fs_reads_total Counter Cumulative count of reads completed
container_fs_read_seconds_total Counter Cumulative count of seconds spent reading
container_fs_reads_merged_total Counter Cumulative count of reads merged
container_fs_sector_reads_total Counter Cumulative count of sector reads completed
container_fs_sector_writes_total Counter Cumulative count of sector writes completed
container_fs_usage_bytes Gauge Number of bytes that are consumed by the container on this filesystem bytes
container_fs_write_seconds_total Counter Cumulative count of seconds spent writing seconds
container_fs_writes_bytes_total Counter Cumulative count of bytes written bytes
container_fs_writes_merged_total Counter Cumulative count of writes merged
container_fs_writes_total Counter Cumulative count of writes completed
container_last_seen Gauge Last time a container was seen by the exporter timestamp
container_memory_cache Gauge Total page cache memory bytes
container_memory_failcnt Counter Number of memory usage hits limits
container_memory_failures_total Counter Cumulative count of memory allocation failures
container_memory_max_usage_bytes Gauge Maximum memory usage recorded bytes
container_memory_rss Gauge Size of RSS bytes
container_memory_swap Gauge Container swap usage bytes
container_memory_usage_bytes Gauge Current memory usage, including all memory regardless of when it was accessed bytes
container_memory_working_set_bytes Gauge Current working set bytes
container_network_receive_bytes_total Counter Cumulative count of bytes received bytes
container_network_receive_packets_dropped_total Counter Cumulative count of packets dropped while receiving
container_network_receive_packets_total Counter Cumulative count of packets received
container_network_receive_errors_total Counter Cumulative count of errors encountered while receiving
container_network_transmit_bytes_total Counter Cumulative count of bytes transmitted bytes
container_network_transmit_packets_total Counter Cumulative count of packets transmitted
container_network_transmit_packets_dropped_total Counter Cumulative count of packets dropped while transmitting
container_network_transmit_errors_total Counter Cumulative count of errors encountered while transmitting
container_network_tcp_usage_total Gauge TCP connection usage statistic for container
container_network_udp_usage_total Gauge UDP connection usage statistic for container
container_spec_cpu_period Gauge CPU period of the container
container_spec_cpu_quota Gauge CPU quota of the container
container_spec_cpu_shares Gauge CPU share of the container
container_spec_memory_limit_bytes Gauge Memory limit for the container bytes
container_spec_memory_swap_limit_bytes Gauge Memory swap limit for the container bytes
container_spec_memory_reservation_limit_bytes Gauge Memory reservation limit for the container bytes
container_start_time_seconds Gauge Start time of the container since UNIX epoch seconds
container_tasks_state Gauge Number of tasks in the given state (sleepingrunningstoppeduninterruptible, or ioawaiting)

Like this post? Don’t forget to share it!

Additional Resources

Summary
Use Google cAdvisor for monitoring your containers + Docker tutorial
Article Name
Use Google cAdvisor for monitoring your containers + Docker tutorial
Description
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.
Author
Publisher Name
Upnxtblog
Publisher Logo

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

jogging Previous post 1st Year of Blogging : TOP 10 best and the most popular reads
Gmail Next post How to enable 2-Step Verification on your Gmail account