In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1. Monitoring commands of Docker Docker
Introduction to simple commands
Ps
Docker container ps is a command that we are already familiar with, making it easy for us to see the currently running container. The new version of Docker provides a new command docker container ls that works and uses exactly the same as docker container ps. However, the meaning of ls may be more accurate than that of ps, so it is more recommended.
Top
If you want to know which processes are running in a container, you can execute the docker container top [container] command. The command can also be followed by the arguments of the Linux operating system ps command to display specific information, such as-au.
Stats
Docker container stats is used to display the usage of various resources in each container. By default, a list of real-time changes is displayed, showing the CPU usage, memory usage and availability of each container. Note: if there is no specific memory specified when the container starts, the limit,stats command will display the total memory of the host, but this does not mean that each container can use so much memory.
In addition, the docker container stats command also displays the IO data of the container network and disk. The default output has the drawback of showing the container ID instead of the name. We can specify the name of the container after the stats command to display only the data for certain containers. Like docker container stats sysdig weave.
Command execution
1.ps
[root@docker01 ~] # docker ps// View Container Information
2.top
[root@docker01 ~] # docker top container name [root@docker01 ~] # docker top wordpress_wordpress_1 / / View the process information running in the container, and support ps command parameters.
3.stats
[root@docker01 ~] # docker stats wordpress_wordpress_1 / / View container statistics in real time, and check the CPU utilization, memory usage and total available memory of the container.
By default, a list of real-time changes is displayed, showing the CPU utilization, memory usage and availability of each container
Note: if there is no specific memory specified when the container starts, the limit,stats command will display the total memory of host, but this does not mean that every container can use so much memory. In addition, the docker container stats command will also show the default output of container network and disk IO data has a drawback, showing the container ID instead of the name. We can specify the name of the container after the stats command to display only the data for certain containers. For example, docker container stats test1 test2 [root@docker01 ~] # docker logs container name [root@docker01 ~] # docker logs wordpress_wordpress_1 / / View the container log 2. Use Sysdig monitoring server [root@docker01 ~] # docker pull sysdig// to download sysdig image via sysdig to run container [root@docker01 ~] # docker run-it-- rm-- name sysdig-- privileged=true-- volume=/var/run/docker.sock:/host/var/run/docker.sock-- volume=/dev:/host/dev-- volume=/proc:/host/proc:ro-- volume=/boot:/host/boot:ro-- volume=/lib/modules:/ Host/lib/modules:ro-- volume=/usr:/host/usr:ro sysdig/sysdig can see The sysdig container runs in privileged mode and reads data such as operating system / dev,/proc. This is to obtain enough system information. After startup, enter the container through docker container exec-it sysdig bash and execute the csysdig command. You can start the sysdig download plug-in interactively and run the following command if you fail to download the plug-in. If you download the plug-in again, you can run the following command After downloading again successfully, you can run the sysdig command, view the monitoring items root@10ccab83a512:/# sysdig//, run the sysdig command, view the monitoring items, and it will dynamically view the use of csysdig
Csysdig is the sysdig software package that operates the user interface of the ncurses library. Ncurses is a dynamic library that provides function key definitions (keyboard shortcuts), screen rendering and graphical interaction based on text terminals. A tool, csysdig, is also provided in the sysdig package. After the tool is executed, the running interface is similar to the top command. The csysdig working interface is shown in figure 5.
Run the csysdig command, view the monitoring items root@10ccab83a512:/# csysdig//, run the csysdig command, and view the monitoring items in the graphical interface. It will dynamically view the csysdig using the following shortcut keys:
P: pause screen output information
Enter: enter the currently highlighted entry.
Ctrl+F: list search.
F1-help Information
F2-displays the view selector. This will take you to another view.
F4-use filter
F5-View IO output information
F7 displays the view currently displayed on the help page.
F8 opens the operator panel of the view.
F9, open the column sorting panel.
Q give up and quit.
Arrows, PgUP, PgDn, Home, End: movement control up and down the icons.
Sysdig monitors different types of resources by different View. Click the bottom Views menu (or press F2) to display the View selection list.
We move the cursor to Containers, and the function description of this view is immediately displayed on the right side of the interface. Enter or double-click Containers to enter the container monitoring interface.
Sysdig displays real-time data for all containers of the host, refreshed every two seconds. The meaning of each column of data is also self-explanatory. If you are not clear, click the Legend at the bottom. If you want to sort by a certain column, such as by the amount of memory used, click the column header VIRT.
If you want to view the progress of a container, move the cursor to the target container, then enter or double-click
You can also continue to double-click to view threads in the process
Go back to the previous level and press the backspace key
The interactive function of sysdig is very strong. If the interface shows a lot of items, you can click on the bottom Search menu and enter keywords to find it.
If you think the interface refreshes too fast to see the information you follow clearly, you can click the Pause menu at the bottom.
Characteristics of sysdig:
(1) complete monitoring information, including Linux operating system and container
(2) the interface is highly interactive.
The disadvantage is that sysdig displays real-time data and does not see changes and trends. Moreover, it is operated on the command line, and it needs to be executed on ssh to host, which is not very convenient.
Summary
These examples are just the tip of the iceberg that demonstrates the capabilities of Sysdig. Among other system monitoring tools at present, I have not seen anything as powerful as Sysdig and so good for containers. Therefore, for users who often use the server, especially the Docker container, as the way the product runs, this is a system tool worth using.
3. Weave Scope of Docker monitoring scheme
The most important feature of Weave Scope is that it automatically generates a map of the Docker container, allowing us to understand, monitor and control the container intuitively. A thousand words are not worth a picture. Feel it first.
[root@docker01 ~] # docker pull scope// download scope image execute the following script to install and run Weave Scope [root@docker01 ~] # curl-L git.io/scope-o / usr/local/bin/scope [root@docker01 ~] # chmod + x / usr/local/bin/scope [root@docker01 ~] # scope launch
Browsers access http://192.168.1.11:4040/
Then you can better monitor and manage containers in docker.
Open docker02 and add docker01 monitoring item
Docker01
Delete weavescope Container
[root@docker01 ~] # docker stop weavescope weavescope [root@docker01 ~] # docker rm weavescope weavescope
Docker02
[root@docker01 ~] # docker pull scope// download scope image [root@docker01 ~] # curl-L git.io/scope-o / usr/local/bin/scope [root@docker01 ~] # chmod + x / usr/local/bin/scope [root@docker01 ~] # scope launch
Docker01
[root@docker01 ~] # scope launch 192.168.1.11 192.168.1.13
Docker02
[root@docker02 ~] # scope launch 192.168.1.13 192.168.1.11 browser visits http://192.168.1.11:4040/
Browsers can also access http://192.168.1.13:4040/.
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: 259
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.