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 install Linux and use the pidstat command to monitor process data

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

Share

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

This article introduces the relevant knowledge of "how to install Linux to use pidstat commands to monitor process data". In the operation of actual cases, many people will encounter such a dilemma, 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!

In fact, there are many Linux system monitoring commands, pidstat command is one of them, you can use the pidstat command to monitor the Linux system process data, but you have to install pidstat before you can use, the following editor will introduce to you how to install Linux using pidstat, interested friends may wish to understand.

The pidstat command is used to monitor independent tasks (processes) managed by the Linux kernel. It outputs information about each task managed by the kernel. The pidstat command can also be used to monitor the children of a particular process. The interval parameter is used to specify the interval between each report. A value of 0 (or no parameters) indicates that the time of the process's statistics is calculated from the start of the system.

How to install pidstat

Pidstat is part of the sysstat software suite, and sysstat contains a number of tools for monitoring the status of linux systems, which are available from software sources in most linux distributions.

On a Debian/Ubuntu system, you can use the following command to install

# apt-get install sysstat

The following command is used in the CentOS/Fedora/RHEL version of linux:

# yum install sysstat

Use pidstat

Using pidstat without any parameters is equivalent to adding the-p parameter, but only active tasks are displayed.

# pidstat

You can see the following in the results:

PID-process number of the task being monitored

% usr-the cpu usage of this task when executed at the user level (application) is independent of nice priority. Note that the cpu time calculated in this field does not include the time spent in the virtual processor.

% system-cpu usage when this task is used at the system level.

% guest-the cpu usage of the task spent on the virtual machine (running on the virtual processor).

% CPU-Total cpu usage of the task. In a SMP environment (multiprocessor), if you enter the-I parameter on the command line, cpu usage is divided by your number of cpu.

CPU-the number of the processor on which this task is running.

Command-the command name for this task.

Ipaw O statistics

Use the-d parameter to get the statistics of Igamot O. For example:

# pidstat-d-p 8472

The IO output shows some entries within:

KB_rd/s-the speed at which the task reads from the hard drive (kb)

KB_wr/s-Speed at which the task writes to the hard disk (kb)

KB_ccwr/s-rate at which task writes to disk are canceled (kb)

Page failure and memory usage

You can get data on memory usage using the-r flag.

Important entries:

Minflt/s-the number of small errors per second when loading data from memory, which do not require memory pages to be loaded from disk.

Majflt/s-the number of large errors per second when loading data from memory, which requires memory pages to be loaded from disk.

VSZ-Virtual capacity: virtual memory usage (kb) for the entire process

RSS-long-term memory usage: task's non-exchangeable physical memory usage (kb)

Give an example

1. You can monitor memory usage by using the following command

# pidstat-r 2 5

This will give you five statistics on page faults, with an interval of 2 seconds. This will make it easier to locate the process in question.

two。 Show the child processes of all mysql servers

# pidstat-T CHILD-C mysql

3. Combine all the statistics into a single easy-to-read report:

# pidstat-urd-h

This is the end of "how to install Linux to use the pidstat command to monitor process data". 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: 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