Linux system monitoring commands There are many, Pidstat command is one of them, using the Pidstat command can be used to monitor the Linux system process data, but first to install the Pidstat to use, The following small series for you to introduce the Linux installation using Pidstat method, interested friends may wish to understand the next.
The Pidstat command is used to monitor standalone tasks (processes) that are 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 the child processes of 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 computed from the start of the system.
How to install Pidstat
Pidstat is part of the Sysstat software suite, Sysstat contains many tools to monitor the state of the Linux system, and it can be obtained from the software sources in most Linux distributions.
The following command can be used to install the Debian/ubuntu system
# Apt-get Install Sysstat
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 the active task is displayed.
# Pidstat
In the results you can see the following:
PID-The process number of the task being monitored
%USR-CPU utilization of this task is independent of Nice priority when executing (application) at the user layer. Note that the CPU time that this field calculates does not include the time spent in virtual processor.
%system-The CPU usage of this task when used at the system level.
%guest-The task spends CPU usage on the virtual machine (running in a processor).
%CPU-The total CPU usage of the task. In an SMP environment (multiprocessor), if you enter the-i parameter at the command line, the CPU usage is divided by the number of CPUs you have.
CPU-the processor number that is running this task.
command-The order name for this task.
I/O statistical data
The I/O statistics are obtained by using the-D parameter. Like what:
# pidstat-d-P 8472
IO output shows some of the entries within:
KB_RD/S-the speed at which the task reads from the hard disk (KB)
KB_WR/S-The write speed of the task to the hard disk (KB)
KB_CCWR/S-the rate at which the task writes to disk is canceled (KB)
Page failures and memory usage
Use-R to mark data that you can get memory usage.
Important Entries:
MINFLT/S-The number of small errors that occur per second when data is loaded from memory, which does not require loading memory pages from the disk.
MAJFLT/S-the number of larger errors that occur per second when data is loaded from memory, and 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: non-exchangeable physical memory usage of a task (KB)
Example
1. You can monitor memory usage by using the following command
# pidstat-r 2 5
This will give you 5 statistical results on page faults, 2 seconds apart. This will make it easier to locate the process where the problem occurs.
2. Show child processes for all MySQL servers
# pidstat-t Child-c MySQL
3. Integration of all statistical data into a single, Easy-to-read report:
# pidstat-urd-h
The above is the Linux installation using Pidstat method introduced, through the introduction of this article, I believe you have the System monitoring command PIDSTAT usage has a certain understanding, if you also want to know more Linux system monitoring commands, see System Home Linux system Monitoring what command to use?