In the last chapter, we looked at how you can use the API built into Docker to gain an insight to what resources your containers are running. Now, we are to see how we can take it to the next level by using cAdvisor from Google. In this chapter, you will cover the following topics:
Google describes cAdvisor as follows:
"cAdvisor (Container Advisor) provides container users an understanding of the resource usage and performance characteristics of their running containers. 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 a container and is machine-wide."
The project started off life as an internal tool at Google for gaining an insight into containers that had been launched using their own container stack.
Google's own container stack was called "Let Me Contain That For You" or lmctfy for short. The work on lmctfy has been installed as a Google port functionality over to libcontainer that is part of the Open Container Initiative. Further details on lmctfy can be found at https://github.com/google/lmctfy/.
cAdvisor is written in Go (https://golang.org); you can either compile your own binary or you can use the pre-compiled binary that are supplied via a container, which is available from Google's own Docker Hub account. You can find this at http://hub.docker.com/u/google/.
Once installed, cAdvisor will sit in the background and capture metrics that are similar to that of the docker stats
command. We will go through these stats and understand what they mean later in this chapter.
cAdvisor takes these metrics along with those for the host machine and exposes them via a simple and easy-to-use built-in web interface.