Use of process management tool htop/glances/dstat, htopglances
Use of process management tool htop/glances/dstat
Linux Process Management Tools: pstree, ps, pidof, pgrep, top, htop, glance, pmap, vmstat, dstat, kill, job, etc.
What is htop?
Htop is a software running in Linux system monitoring and process management, used to replace the traditional top in Unix. Unlike top, which only provides the list of processes that consume the most resources, htop provides a list of all processes and uses color to identify the processor, swap, and memory status.
You can choose to install and use htop if top does not provide detailed system information. For example, when you are looking for memory leaks in an application. Compared with top, htop provides a more convenient and cursor-controlled interface to kill processes.
Htop is written in C language and uses the ncurses library. The htop name comes from the name of the author.
Next, I will only introduce three relatively advanced tools.
Htop:
Install htop:
Yum-y install htop
Htop is an interactive process browser in Linux, the enhanced version of top
Option:
-D #: Refresh Interval
-U USERNAME: displays only the processes of the specified user.
-S COLUMN: sort by specified fields
Interactive commands:
U: displays only the processes of the specified user.
S: trace system calls initiated by the selected Process
L: trace files opened by the selected Process
T: displays the process tree.
A: Set cpu affinity (bind the selected process to a CPU)
For the specific usage of htop, I would like to look for more relevant documents, and then take a closer look at the man manual.
Htop display:
Glances:
What is Glances?
Glances is a cross-platform Command Line System Monitoring Tool written in Python that uses the psutil library to capture information from the system based on curses. With Glances, we can monitor the utilization of CPU, average load, memory, network traffic, disk I/O, Other Processors and file system space.
Glances is a free software used to monitor GPL authorization of GNU/Linux and FreeBSD operating systems.
Glances also provides many practical options. One of the main functions we can see in the configuration file is to set key values and corresponding labels (careful [Be careful], warning [warning] and critical [Severe]). then she will automatically help us to mark the system to reach a bottleneck with different colors.
Glances Main Functions
CPU information (User-related applications, system core programs and idle programs)
Total memory information, including physical memory, swap space and idle memory
Average CPU load for the previous 1 minute, 5 minutes, and 15 minutes
Downlink and uplink speeds of Network Connections
Total number of processors and their active status
Hard Disk I/O-related (read/write) speed details
Disk usage of the current mounted device
Process name used for high CPU and memory, and location of related applications
Display the current date and time at the bottom
Mark processes that consume the most system resources in red
Interactive commands: There are many interactive commands to define glances display information and sorting methods;
H: Show Help
Run the glances command in C/S Mode:
Service Mode:
Glances-S-B IPADDR (s is the service mode enabled)
IPADDR: the address of the local machine that you listen
Client mode:
Glances-c IPADDR
IPADDR: Address of the remote server listener
Glances [-bdehmnrsvyz1] [-B bind] [-c server] [-C conffile] [-p port] [-P password] [-- password] [-t refresh] [-f file] [-o output]
-B: displays the NIC data rate in bytes;
-D: Disable the disk I/O module.
-F/path/to/somewhere: Set the output fileLocation and format;
-O {HTML | CSV}
-M: Disable the mount module.
-N: Disable the network module.
-T #: Specifies the refresh interval.
-1: Data of each CPU is displayed separately.
If I want to display the parameters captured by the local glances to the web, I can set nginx
1. Compile and install nginx
2. Switch cd/usr/local/nginx to the nginx directory to see if there is any html
3. glances-o HTML-f/usr/local/nginx/html
4. Enter 172.16.249.247 as the IP address of my VM on the web, and then output 172.16.249.247/glances.html
Dstat:Support plug-ins
Dstat is a tool used to replace vmstat, iostat netstat, nfsstat, and ifstat commands. It is an all-around system information statistics Tool. compared with sysstat, dstat has a color interface, which is easy to observe when you manually observe the performance. dstat supports instant refresh, such as entering dstat 3, that is, the data is collected every three seconds, but the latest data is refreshed every second. similar to sysstat, dstat can also collect specified performance resources. For example, dstat-c shows CPU usage.
Dstat [-afv] [options...] [delay [count]
-C: the cpu is also used. information such as CPU system usage, user usage, idle, waiting, interrupted, and software interruption is displayed.
-D: whether the disk is, and the size of read/write data on the disk is displayed.
-G, -- page display page usage
-I-int enable interrupt stats to enable interrupt Data
-L: load average: displays the system load.
-M: displays memory usage for memory.
-P: process displays the process status
-R, -- io
-S, -- swap
-T, -- time
-Y, -- sys
-- Aio: displays asynchronous io statistics
-- Ipc: ipc-related information
-- Raw: raw socket
-- Tcp: tcp socket
-- Udp: udp socket
-- Socket: raw, tcp, udp
-- Unix: unix sock
-- Top-cpu: displays the processes that occupy the most CPU.
-- Top-bio: display the process that occupies the most block IO
-- Top-mem: displays the most memory-consuming processes.
-- Top-io: processes that occupy the most IO