How to install Linux using the pidstat command

  
                

There are many commands for monitoring the Linux system. The pidstat command is one of them. You can use the pidstat command to monitor the process data of the Linux system. However, you must first install the pidstat before you can use it. Linux installation using pidstat method, 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 that is managed by the kernel. The pidstat command can also be used to monitor child processes for a particular process. The interval parameter is used to specify the time interval between each report. Its value of 0 (or no parameters) indicates that the time of the process's statistics is calculated from the system startup.

How to install pidstat

pidstat is part of the sysstat software suite, sysstat contains many tools to monitor system status linux, it can be obtained from most linux distributions of the software source.

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

# apt-get install sysstat

The CentOS/Fedora/RHEL version of linux uses the following Command:

# yum install sysstat

Using pidstat

Using pidstat without any arguments is equivalent to adding the -p argument, but only active tasks are displayed come out.

# pidstat

You can see the results in the following:

PID - the process being monitored task number

% usr - The cpu usage of this task when executing at the user level (application), regardless of the nice priority. Note that the cpu time calculated by this field does not include the time spent in the virtual processor.

%system - The CPU usage of this task when used at the system level.

%guest - The cpu usage (running on the virtual processor) that the task spends on the virtual machine.

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

CPU - The processor number on which this task is running.

Command - The command name for this task.

I/O Statistics

Get I/O statistics by using the -d parameter. For example:

# pidstat -d -p 8472

IO output displays the number of entries in:

kB_rd /s - the task is read from the hard disk Speed ​​(kb)

kB_wr/s - write speed of the task to the hard disk (kb)

kB_ccwr/s - rate at which the task write disk is canceled (kb)

Page Failure and Memory Usage

Use -r to mark data that you can get memory usage.

important entries:

minflt /s - a small number of errors that occur per second when loading data from memory, these pages are not required to be loaded into memory from disk.

majflt/s - The number of large errors per second that occur when loading data from memory. These requirements are loaded from the disk into the memory page.

VSZ - Virtual Capacity: Virtual Memory Usage for the Entire Process (kb)

RSS - Long Term Memory Usage: Usage of Non-Exchangeable Physical Memory for Tasks (kb)

Example

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

# pidstat -r 2 5

This will give you 5 statistics about page faults. As a result, the interval is 2 seconds. This will make it easier to locate the process in question.

2. Display all child processes of the mysql server

# pidstat -T CHILD -C mysql

3. Combine all statistics into a single report that is easy to read中:

# pidstat -urd -h

The above is the introduction of the Linux installation using pidstat. Through the introduction of this article, I believe you have a certain understanding of the usage of the system monitoring command pidstat. If you want to know more about Linux system monitoring commands, see the commands used by the system home Linux system monitoring.

Copyright © Windows knowledge All Rights Reserved