This article is a mirror article of machine translation, please click here to jump to the original article.

View: 6097|Reply: 1

Practical use cAdvisor to collect Docker container metrics

[Copy link]
Posted on 1/25/2022 10:32:09 AM | | | |
Requirements: Check the health of the docker container, collect various metrics of the container, search for "container_exporter", and find:The hyperlink login is visible.It is found that it has been deprecated, and it is recommended to use "cAdvisor".

cAdvisor (Container Advisor)

GitHub address:The hyperlink login is visible.

Documentation:The hyperlink login is visible.

cAdvisor (Container Advisor) gives container users an understanding of the resource usage and performance characteristics of the containers they are running. It is a running daemon that collects, aggregates, processes, and exports information about running containers. Specifically, it holds resource isolation parameters, historical resource usage, histograms of complete historical resource usage, and network statistics for each container. This data is exported from the container and machine range.

The Docker direct view container resource consumption command is as follows:


The Docker command to view disk usage information directly for a service is as follows:

The environment I use is as follows:

  • Docker version 20.10.10
  • CentOS 7 64-bit

[root@itsvse-doc ~]# docker version
Client: Docker Engine - Community
Version:           20.10.10
API version:       1.41
Go version:        go1.16.9
Git commit:        b485636
Built:             Mon Oct 25 07:44:50 2021
OS/Arch:           linux/amd64
Context:           default
Experimental:      true

Server: Docker Engine - Community
Engine:
  Version:          20.10.10
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       e2f740d
  Built:            Mon Oct 25 07:43:13 2021
  OS/Arch:          linux/amd64
  Experimental:     false
containerd:
  Version:          1.4.11
  GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8
runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Run cAdvisor

In CentOS 7, for example, the command is as follows:


Try using a browser to access:http://192.168.1.213:8085/, as shown in the figure below:



Monitor cAdvisor with Prometheus

Review:

Grafana+Prometheus+Node Exporter fetches Linux server metrics
https://www.itsvse.com/thread-9971-1-1.html

Grafana+Prometheus+Windows Exporter monitors service performance metrics
https://www.itsvse.com/thread-9671-1-1.html

Try to visit:http://192.168.1.213:8085/metrics, as shown in the figure below:



Documentation:The hyperlink login is visible.

Grafana Dashboard Address:The hyperlink login is visible.


prometheus.yml The configuration is as follows:

Restart the Prometheus service to get docker running metrics.

Import the dashboard using grafana, after a few minutes of running, as shown in the image below:






Previous:CentOS 7 uses rpm to install the MySQL database
Next:Spring Boot MessageSource The pit of internationalized languages
 Landlord| Posted on 1/25/2022 1:25:54 PM |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com