Preface
We know that the biggest advantage of the container compared to the cloud host is the ability to share resources, that is, you can create more containers than the cloud host to work together, of course, so many containers unified management, operation and maintenance monitoring may be the topic we need to pay attention to, then introduce a better container monitoring tool.
--------------------------------------------------------------------------------------
Blog:http://blog.csdn.net/chinagissoft
QQ Group: 16403743
Tenet: Focus on "gis+" Frontier technology research and exchange, cloud computing technology, big Data technology, container technology, Internet of Things and GIS deep integration, explore "gis+" technology and industry solutions
Reprint Description: articles are allowed to be reproduced, but must be linked to the source address, otherwise investigate legal responsibility!
--------------------------------------------------------------------------------------
Of course, Docker has its own container monitoring function, which can be used to monitor the performance of the container, the indicator view
Mainly include:
- CPU status and usage of the host
- Memory status and usage of the host
- Local mirror condition of the host
- Container operation of the host
We used Docker Ps-a repeatedly, Docker images command to see both, and of course Docker Stats command is to monitor relevant container instances
[Email protected]:~# docker stats Master test1 test2container CPU% mem usage/limit mem% NET I/o BL Ock I/O pidsmaster 0.00% 10.35 mb/33.61 GB 0.03% 1.338 kb/648 B 9.122 mb/12.29 KB 0tes T1 0.00% 8.192 kb/33.61 GB 0.00% 2.634 kb/648 b 0 b/0 b 0test2 0.00% 282.6 k b/33.61 GB 0.00% 1.986 kb/648 b 0 b/0 b 0
You can also use a similar top command to view the progress of a process
[Email protected]:~# docker top Masteruid PID PPID C stime TTY time cmdroot 11502 11487 0 09:48 pts/26 00:00:00 /bin/bash/root/run.shroot 11519 11502 0 09:48 pts/26 00:00:00 /bin/sh/etc/init.d/ssh start-droot 11534 11519 0 09:48 pts/26 00:00:00 /usr/sbin/sshd-d
If you want to see more detailed container properties, you can also use the Docker remote API to view (see below) through Netcat. Send an HTTP GET request/containers/[CONTAINER_NAME], whereCONTAINER_NAMEis the name of the container you want to count. You can get fromOver hereSee the full response information for a container stats request. In the example above you will get the details of the cache, swap space, and memory.
Of course, this way is not acceptable, we still want to see a very intuitive, detailed visual interface, pay attention to the user experience.
cadvisor is an easy-to-set and very useful tool that we don't have to SSH to the server to see resource consumption, and it also generates graphs for us. In addition, the pressure gauge (pressure gauges) provides a quick preview when the cluster requires additional resources. Also, unlike the other tools in this article, Cadvisor is free and open source. In addition, its resource consumption is also relatively low. However, it has its limitations and it can only monitor one Docker host. Therefore, if you are multi-node, then it is more troublesome, you have to install a cadvisor on all the host, the person must be particularly inconvenient. It is worth noting that if you are using Kubernetes, you can use the heapster
The biggest benefit of cadvisor is the simple configuration and free trial.
1. Download the relevant image
[Email protected]:~# docker pull google/cadvisor:latestlatest:pulling from Google/cadvisor552b69c7399e:pull complete A3ed95caeb02:pull Complete Fd2c5cdc47b1:pull Complete E1d2af7223fb:pull complete digest:sha256 : 23da68ea2fd51d990e5b68c5886a9de43f1d030aa9c3fb36e9c50d2784a6a21astatus:downloaded newer image for Google/cadvisor : Latest
2. Enable Mirror container instance, map port
[Email protected]:~# docker run >--volume=/:/rootfs:ro >--volume=/var/run:/var/run:rw >-- Volume=/sys:/sys:ro >--volume=/var/lib/docker/:/var/lib/docker:ro >--publish=8080:8080 >- -detach=true >--name=cadvisor > Google/cadvisor: Latest953fa954d08fb22903ac3df29d5f9e3dcf22f0e53cfd29195166de656cd6ba15[email protected]:~# Docker Ps-acontainer ID IMAGE COMMAND CREATED STATUS PORTS names953fa954d08f google/cadvisor:latest "/usr/bin/ Cadvisor-l "About a minute ago up about a minute 0.0.0.0:8080->8080/tcp cadvisor
3. Open the link to view
Container host ip:8080
Also, view the monitoring information for the specific Docker container
View a single container (the curve does not fluctuate because the container has no action)
Of course, the container is enough for us to use, but more professional companies, the tool shows insufficient detail of Docker information, integration is not very strong, and no ability to generate alerts, can only monitor container resources, not support non-Docker resource monitoring.
Compare, free stuff, what else do you want?
If you have the above requirements, you can use the Dockerdog and other related tools.
Common container monitoring Tools--google cadvisor