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:
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:
|