Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to monitor docker containers

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to monitor docker containers". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The operation and maintenance of docker is a system, and the monitoring system, as an important part of the operation and maintenance system, needs to be considered in the process of Docker operation and maintenance.

There are differences in the degree of virtualization between containers and common virtual machines, and there are also differences in monitoring methods. A virtual machine can be treated as a physical machine, and the container can also be treated as a virtual machine, but this is not in line with the concept of container use. In the implementation of monitoring, we prefer to think of the container as a series of process trees on the host.

Some Docker monitoring schemes that have emerged in the industry, such as Docker Stats, CAdvisor, Scout and so on, also monitor the container on the host computer.

Modeling Container Monitoring Scheme

This scheme is beneficial to get through with the basic CMDB system of operation and maintenance, and at the same time can take into account more levels of monitoring. Monitoring system generally involves: data acquisition, data storage, data analysis and alarm, data display and other parts.

1. Monitoring object model

Here we will use the structure of a product tree to model the monitoring object. The monitoring objects are divided into four categories, namely, product, application, cluster and node.

Product: generally a high-level concept, a product can generally be exported independently and provide services to the outside world. Application: it is composed of modules under the product, and multiple applications work together to form a product. Cluster: is the existence form of the application. For the same application, multiple clusters are generally deployed according to environment, region, etc. Nodes: resources that host services in a cluster, including servers, virtual machines, containers, etc.

In this way, our monitoring data collection and view display can be done based on the hierarchical monitoring object of the product tree. There can be custom monitoring items on each monitoring object, or you can inherit the upper monitoring items. At the same time, the hierarchical monitoring objects can reflect the running status and problems of the system from a variety of levels when the monitoring structure is well organized.

two。 Collector model

Mainly used for data acquisition module, while meeting the data output specification, in order to facilitate analysis, while having a better data structure display, we can use Json format as the data specification. The semantics of the data need to match the corresponding data model. For example, a collector for a node model can be a script that captures the output of the script execution to obtain data from the corresponding data model. On the other hand, the collector of the upper node is generally based on some calculations of the node data model, which generally include sum,avg,max,min and so on, which generally reflect some aggregated data of the nodes under the whole cluster.

3. Data model

Used to define the format of monitoring data, the model includes data items and indicator items. A data item generally contains one or more indicator items. The data in the data model comes from the corresponding collector.

For example, the following model can be monitored for CPU: data item: cpu, indicator item: usr,sys,idle

4. Alarm rule model

On the basis of the data model, the alarm model can be set for each data index project. For example, if an alarm is triggered when the idle CPU is less than 50%, the following rule can be established: cpu.idle < 50

5. View model

This model associates the data model with the view. Contains definitions of how data is presented, for example, trend charts, tables, and so on. The view display mode of specific data indicators can be described by combining the data items and index items in the data model. The views on different monitoring objects can generally reflect the monitoring from different levels.

6. Monitoring item model

The monitoring item model includes the combination of collector model, data model, alarm rule model, view model and so on. By applying the monitoring item to the monitoring object. Thus, the monitoring object can be monitored by custom modeling.

This is the end of "how to monitor docker containers". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 230

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report