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 use the atop command in Linux

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you "how to use atop commands in Linux", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use atop commands in Linux" this article.

Atop is a very powerful linux server monitoring tool, its data collection mainly includes: CPU, memory, disk, network, process and so on, and the content is very detailed.

Atop tools for monitoring Linux system resources and processes

Additional note: [non-internal program, need to be installed] it records the running status of the system at a certain frequency, and the collected data includes the usage of system resources (CPU, memory, disk and network) and the operation of the process, and can be saved on disk in the form of log files. When there is a problem with the server, we can obtain the corresponding atop log files for analysis. Atop is an open source software, from which we can get its source code and rpm installation package.

Syntax atop (option) (parameter) describes the ATOP column: this column displays the hostname, information sampling date, and time point

PRC column: this column shows the overall operation of the process

The sys and usr fields indicate the running time of the process in kernel mode and user mode, respectively.

# proc field indicates the total number of processes

# the zombie field indicates the number of dead processes

# exit field indicates the number of processes exited during the atop sampling period

CPU column: this column shows the overall usage of CPU (that is, multicore CPU as an overall CPU resource). We know that CPU can be used to execute processes, handle interruptions, or be idle (there are two idle states, one is that the active process waits for disk IO to cause CPU to be idle, and the other is completely idle)

The sys and usr fields indicate the time ratio of kernel state and user state to CPU of the process when CPU is used to process the process.

The irq field indicates the percentage of time that CPU is used to handle interrupts

The idle field indicates the percentage of time that CPU is in a fully idle state

The wait field indicates the percentage of time that CPU spent in the state of "the process waits for disk IO to cause CPU to idle"

Each field of the CPU column indicates that the sum of the values is N00%, where N is the number of cpu kernels.

Cpu column: this column shows the usage of a core cpu. The meaning of each field can be found in the CPU column.

CPL column: this column shows the CPU load

Avg1, avg5, and avg15 fields: average number of processes in the run queue in the past 1 minute, 5 minutes, and 15 minutes

The csw field indicates the number of contextual exchanges

The intr field indicates the number of interrupts that occurred

MEM column: this column indicates memory usage

The tot field indicates the total physical memory

The free field indicates the size of free memory

The cache field indicates the amount of memory used for page caching

The buff field indicates the amount of memory used for file caching

The slab field indicates the amount of memory consumed by the system kernel

SWP column: this column indicates the use of swap space

The tot field indicates the total amount of the exchange area

The free field indicates the amount of free swap space

PAG column: this column indicates virtual memory paging

Swin and swout fields: number of pages swapped in and out of memory

DSK column: this column indicates disk usage, one column for each disk device, and one more column of DSK information if there is a sdb device.

Sda field: disk device ID

Busy field: disk busy hour ratio

Read and write fields: number of read and write requests

NET column: multiple columns of NET show the state of the network, including the transport layer (TCP and UDP), the IP layer, and the active network port information

The XXXi field indicates the number of packets received at each layer or active network port

The XXXo field indicates the number of packets sent by each layer or active network port

The atop log sampling page at each point in time is combined to form an atop log file, which can be viewed using the "atop-r XXX" command. In what form do you save the atop log file?

For how atop log files are saved, we can do this:

Save an atop log file every day, which records the information of the day

Log files are named in the way "atop_YYYYMMDD"

Set the expiration period of the log, and automatically delete the log files before a certain period of time.

In fact, atop developers have provided the above log storage methods, and the corresponding atop.daily scripts can be found in the source directory. In the atop.daily script, we can change the sampling period of atop information by modifying the INTERVAL variable (default is 10 minutes), and change the number of days saved in the log (default is 28 days) by changing the values in the following command:

(sleep 3; find $LOGPATH-name 'atop_*'-mtime + 28-exec rm {}\;) & finally, we modify the cron file to execute the atop.daily script every morning:

0 * root / etc/cron.daily/atop.daily above is all the contents of this article entitled "how to use atop commands in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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: 223

*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

Development

Wechat

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

12
Report