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 CPU and virtual memory running information in Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces how to monitor CPU and virtual memory operation information in Linux, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

Mpstat

Mpstat, the abbreviation of Multiprocessor Statistics, is a real-time system monitoring tool. It reports along with some statistics for CPU, which are stored in the / proc/stat file. In a multi-CPUs system, it can view not only the average status information of all CPU, but also the information of a specific CPU. The most important feature of mpstat is that it can view the statistics of each computing core in the multi-core cpu, while the similar tool vmstat can only view the overall cpu of the system.

Grammar

Mpstat [- P {| ALL}] [internal [count]]

Parameters.

-P {| ALL} indicates which CPU to monitor. The value of cpu is in [the number of CPUs-1].

The interval between two adjacent samples of the internal,

The number of count samples. Count can only be used with delay.

When there are no parameters, mpstat displays the average of all information since the system was started. With interval, the average information in the first line since the system was started. Starting from the second line, the output is the average information of the previous interval period. Mpstat, the abbreviation of Multiprocessor Statistics, is a real-time system monitoring tool. It reports along with some statistics for CPU, which are stored in the / proc/stat file. In a multi-CPUs system, it can view not only the average status information of all CPU, but also the information of a specific CPU. The most important feature of mpstat is that it can view the statistics of each computing core in the multi-core cpu, while the similar tool vmstat can only view the overall cpu of the system.

Grammar

Mpstat [- P {| ALL}] [internal [count]]

Parameters.

-P {| ALL} indicates which CPU to monitor. The value of cpu is in [the number of CPUs-1].

The interval between two adjacent samples of the internal,

The number of count samples. Count can only be used with delay.

When there are no parameters, mpstat displays the average of all information since the system was started. With interval, the average information in the first line since the system was started. Starting from the second line, the output is the average information of the previous interval period.

Example

# mpstat-P ALL 2 # View the current health information of the multicore CPU core and update it every 2 seconds

Field meaning:

% user in the internal period, the CPU time in user mode (%), excluding the negative process (usr/total) * 100

% nice in the internal period, the nice value is the CPU time of the negative process (%) (nice/total) * 100

% sys in the internal period, kernel time (%) (system/total) * 100

% iowait during the internal period, hard disk IO wait time (%) (iowait/total) * 100

% irq in the internal period, hard outage time (%) (irq/total) * 100

% soft in the internal period, soft interrupt time (%) (softirq/total) * 100

% idle during the internal period, CPU idle time for any reason except waiting for disk IO operation (%) (idle/total) * 100

Vmstat

Vmstat reports statistics for virtual memory

Usage

Vmstat [- a] [- n] [- S unit] [delay [count]]

Vmstat [- s] [- n] [- S unit]

Vmstat [- m] [- n] [delay [count]]

Vmstat [- d] [- n] [delay [count]]

Vmstat [- p disk partition] [- n] [delay [count]]

Vmstat [- f]

Vmstat [- V]

Parameters.

-a: displays active and inactive memory

-f: displays the number of fork since the system was started. Extension: http://www.cnblogs.com/leoo2sk/archive/2009/12/11/talk-about-fork-in-linux.html

-m: display slabinfo

-n: displays each field name only once at the beginning.

-s: displays memory-related statistics and a variety of system activity.

Delay: refresh interval. If not specified, only one result is displayed.

Count: number of refreshes. If you do not specify the number of refreshes, but specify the refresh interval, the number of refreshes is infinite.

-d: displays disk-related statistics.

-p: displays the specified disk partition statistics

-S: displays in the specified units. The parameters are k, K, m, M, which represent 1000, 1024, 1000000, and 1048576 bytes (byte), respectively. The default unit is K (1024 bytes)

-V: displays vmstat version information.

Thank you for reading this article carefully. I hope the article "how to monitor CPU and virtual memory operation information in Linux" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

*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