nordvpn
System Mechanic® Ultimate Defense™
Coursera Plus

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

Subscribe to Emails

More than 100,000 subscribers across the world trust & read Upnxtblog articles. Subscribe to emails updates!
* indicates required
cAdvisor Metrics (1)

Image – cAdvisor Metrics (1)

 

cAdvisor Metrics (2)

Image – cAdvisor Metrics (2)

Generic Category (English)728x90

cAdvisor Metrics

Metric nameTypeDescriptionUnit (where applicable)
container_accelerator_duty_cycleGaugePercent of time over the past sample period during which the accelerator was actively processingpercentage
container_accelerator_memory_total_bytesGaugeTotal accelerator memorybytes
container_accelerator_memory_used_bytesGaugeTotal accelerator memory allocatedbytes
container_cpu_cfs_periods_totalCounterNumber of elapsed enforcement period intervals
container_cpu_cfs_throttled_periods_totalCounterNumber of throttled period intervals
container_cpu_cfs_throttled_seconds_totalCounterTotal time duration the container has been throttledseconds
container_cpu_load_average_10sGaugeValue of container CPU load average over the last 10 seconds
container_cpu_schedstat_run_periods_totalCounterNumber of times processes of the cgroup have run on the CPU
container_cpu_schedstat_run_seconds_totalCounterTime duration the processes of the container have run on the CPUseconds
container_cpu_schedstat_runqueue_seconds_totalCounterTime duration processes of the container have been waiting on a runqueueseconds
container_cpu_system_seconds_totalCounterCumulative system CPU time consumedseconds
container_cpu_usage_seconds_totalCounterCumulative CPU time consumedseconds
container_cpu_user_seconds_totalCounterCumulative user CPU time consumedseconds
container_fs_inodes_freeGaugeNumber of available Inodes
container_fs_inodes_totalGaugeTotal number of Inodes
container_fs_io_currentGaugeNumber of I/Os currently in progress
container_fs_io_time_seconds_totalCounterCumulative count of seconds spent doing I/Osseconds
container_fs_io_time_weighted_seconds_totalCounterCumulative weighted I/O timeseconds
container_fs_limit_bytesGaugeNumber of bytes that can be consumed by the container on this filesystembytes
container_fs_reads_bytes_totalCounterCumulative count of bytes readbytes
container_fs_reads_totalCounterCumulative count of reads completed
container_fs_read_seconds_totalCounterCumulative count of seconds spent reading
container_fs_reads_merged_totalCounterCumulative count of reads merged
container_fs_sector_reads_totalCounterCumulative count of sector reads completed
container_fs_sector_writes_totalCounterCumulative count of sector writes completed
container_fs_usage_bytesGaugeNumber of bytes that are consumed by the container on this filesystembytes
container_fs_write_seconds_totalCounterCumulative count of seconds spent writingseconds
container_fs_writes_bytes_totalCounterCumulative count of bytes writtenbytes
container_fs_writes_merged_totalCounterCumulative count of writes merged
container_fs_writes_totalCounterCumulative count of writes completed
container_last_seenGaugeLast time a container was seen by the exportertimestamp
container_memory_cacheGaugeTotal page cache memorybytes
container_memory_failcntCounterNumber of memory usage hits limits
container_memory_failures_totalCounterCumulative count of memory allocation failures
container_memory_max_usage_bytesGaugeMaximum memory usage recordedbytes
container_memory_rssGaugeSize of RSSbytes
container_memory_swapGaugeContainer swap usagebytes
container_memory_usage_bytesGaugeCurrent memory usage, including all memory regardless of when it was accessedbytes
container_memory_working_set_bytesGaugeCurrent working setbytes
container_network_receive_bytes_totalCounterCumulative count of bytes receivedbytes
container_network_receive_packets_dropped_totalCounterCumulative count of packets dropped while receiving
container_network_receive_packets_totalCounterCumulative count of packets received
container_network_receive_errors_totalCounterCumulative count of errors encountered while receiving
container_network_transmit_bytes_totalCounterCumulative count of bytes transmittedbytes
container_network_transmit_packets_totalCounterCumulative count of packets transmitted
container_network_transmit_packets_dropped_totalCounterCumulative count of packets dropped while transmitting
container_network_transmit_errors_totalCounterCumulative count of errors encountered while transmitting
container_network_tcp_usage_totalGaugeTCP connection usage statistic for container
container_network_udp_usage_totalGaugeUDP connection usage statistic for container
container_spec_cpu_periodGaugeCPU period of the container
container_spec_cpu_quotaGaugeCPU quota of the container
container_spec_cpu_sharesGaugeCPU share of the container
container_spec_memory_limit_bytesGaugeMemory limit for the containerbytes
container_spec_memory_swap_limit_bytesGaugeMemory swap limit for the containerbytes
container_spec_memory_reservation_limit_bytesGaugeMemory reservation limit for the containerbytes
container_start_time_secondsGaugeStart time of the container since UNIX epochseconds
container_tasks_stateGaugeNumber of tasks in the given state (sleepingrunningstoppeduninterruptible, or ioawaiting)

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

Additional Resources


Also published on Medium.

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
%d bloggers like this: