installs Zabbix, we can install Maxserver to display the data on a large screen. After
completes Maxserver installation, the host in Zabbix will automatically synchronize to Maxserver, and you will see the following panel.
Running status of all hosts Large screen
Detailed running screen of each host
pidstat Overview
pidstat is a command of the sysstat tool to monitor the occupancy of system resources such as cpu, memory, thread, and device IO of all or specified processes. When pidstat is run for the first time, it displays various statistical information since the start of the system. Afterwards, running pidstat will display the statistical information since the last time the command was run. Users can obtain the required statistical information by specifying the number and time of statistics.
pidstat Installation
pidstat is part of the sysstat software suite. sysstat contains many tools for monitoring the status of the Linux system. It can be obtained from the software sources of most Linux distributions.
· In Debian/Ubuntu system, you can use the following command to install: apt-get install sysstat
· CentOS/Fedora/RHEL version of linux use the following command: yum install sysstat
pidstat Example
pidstat usage:
pidstat [option] [ ] []
as shown below:
commonly used parameters:
· -u: the default parameters, display the cpu usage statistics of each process
· -r: display the memory usage statistics of each process
· -d: display the IO of each process Usage
· -p: Specify the process number
· -w: Display the context switching of each process
· -t: Display extra information besides the statistics of the thread of the selected task
· -T {TASK | CHILD | ALL } This option specifies what pidstat monitors. TASK means reporting an independent task, and the CHILD keyword means reporting statistics of all threads in the process. ALL means to report an independent task and all threads under the task. Note: The global statistics of tasks and child threads have nothing to do with the pidstat option. These statistics will not correspond to the current statistics interval. These statistics will only be collected when the child thread is killed or completed.
· -V: Version number
· -h: All activities are displayed on one line so that other programs can be easily parsed.
· -I: In the SMP environment, it indicates the CPU usage/core number of the task
· -l: Displays the command name and all parameters
Example 1: View the CPU usage of all processes (-u -p ALL)
pidstat
pidstat -u- p ALL
pidstat and pidstat -u -p ALL are equivalent. By default, pidstat displays the cpu usage of all processes.
Detailed description
· PID: Process ID
· %usr: Percentage of CPU occupied by the process in user space
· %system: Percentage of CPU occupied by process in kernel space
· %guest: Percentage of process occupied by CPU in virtual machine
·% CPU: the percentage of cpu occupied by the process
· CPU: the cpu number of the processing process
· Command: the command corresponding to the current process
Example 2: cpu usage statistics (-u)
pidstat -u
use the -u option, pidstat will display the cpu usage statistics of each active process. Executing "pidstat -u" has the same effect as executing "pidstat" alone.
Example 3: Memory usage statistics (-r)
pidstat -r
Use the -r option, pidstat will display the memory usage statistics of each active process:
· PID: process identifier
· Minflt/s: task occurrence times per second To make mistakes, you don’t need to load pages
from disk. Majflt/s: The main error of the task every second, you need to load pages from disk
. VSZ: virtual address size, virtual memory usage KB
. RSS: resident collection size , Non-swap area Wuli memory usage KB
·Command: task command name
Example 4: Display the IO usage of each process (-d)
pidstat -d
Report IO statistics show the following information:
·PID: process id
· kB_rd/s : KB
·kB_wr/s read from the disk per second: KB
·kB_ccwr/s written to the disk per second: KB written to the disk whose task is cancelled. It happens when the task truncates the dirty pagecache.
· COMMAND: task command name
Example 5: Display the context switching status of each process (-w)
pidstat -w -p PID
· Cswch/s: the number of active task context switches per second
· Nvcswch/s: per second The number of passive task context switches
·Command: command name
Example 6: Display additional information other than the statistical information of the thread of the selected task (-t)
pidstat -t -p PID
· TID: thread id
· %usr: The process is in user space Percentage of CPU occupied
· %system: Percentage of CPU occupied by the process in the kernel space
· %guest: Percentage of CPU occupied by the process in the virtual machine
· %CPU: Percentage of CPU occupied by the process
· CPU: CPU number of the processing process
· Command: The command
corresponding to the current process Example 7: pidstat -T
pidstat -T TASK
pidstat -T CHILD
pidstat -T ALL
TASK means reporting an independent task. The CHILD keyword means to report all thread statistics under the process. ALL means to report an independent task and all threads under the task.
Note: The global statistics of task and child threads have nothing to do with the pidstat option. These statistics will not correspond to the current statistics interval. These statistics will only be collected when the child thread is killed or completed.
PID: process id
· Usr-ms: the number of milliseconds used by tasks and child threads at the user level.
· System-ms: The number of milliseconds used by tasks and subthreads at the system level.
· Guest-ms: The number of milliseconds used by tasks and child threads in a virtual machine (running a virtual processor).
·Command: Command name