Book Image

Monitoring Docker

By : Russ McKendrick
Book Image

Monitoring Docker

By: Russ McKendrick

Overview of this book

This book will show you how monitoring containers and keeping a keen eye on the working of applications helps improve the overall performance of the applications that run on Docker. With the increased adoption of Docker containers, the need to monitor which containers are running, what resources they are consuming, and how these factors affect the overall performance of the system has become the need of the moment. This book covers monitoring containers using Docker's native monitoring functions, various plugins, as well as third-party tools that help in monitoring. Well start with how to obtain detailed stats for active containers, resources consumed, and container behavior. We also show you how to use these stats to improve the overall performance of the system. Next, you will learn how to use SysDig to both view your containers performance metrics in real time and record sessions to query later. By the end of this book, you will have a complete knowledge of how to implement monitoring for your containerized applications and make the most of the metrics you are collecting
Table of Contents (15 chapters)
Monitoring Docker
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

What just happened?


While running the ApacheBench test, you may have noticed that the CPU utilization on the container running NGINX and PHP was high; in the example in the previous section, it was using 139.62 percent of the available CPU resource.

As we did not attach any resource limits to the containers we launched, it was easy for our test to use all of the available resources on the host Virtual Machine (VM). If this VM was being used by several users, all running their own containers, they may have started to notice that their applications had started to slow down or, even worse, the applications had started showing errors.

If you ever find yourself in this situation, you can use docker stats to help track down the culprit.

Running docker stats $(docker ps -q) will stream the statistics for all the currently running containers:

CONTAINER       CPU %     MEM USAGE/LIMIT     MEM %    NET I/O
361040b7b33e    0.07%     86.98 MB/1.905 GB   4.57%    2.514 kB/738 B
56b459ae9092    120.06% ...