We mentioned earlier that there are many Linux system monitoring tools that can be used to monitor system performance. However, we estimate that more users may prefer tools (top commands) that are included in most Linux distributions ). The top command is a real-time task manager in Linux. it is also used to find the system performance in the GNU/Linux release.
We mentioned earlier that there are many Linux system monitoring tools that can be used to monitor system performance. However, we estimate that more users may prefer tools (top commands) that are included in most Linux distributions ).
The top command is a real-time task manager in Linux. it is also a common system monitoring tool used to find system performance bottlenecks in the GNU/Linux release and to help us make the right operations. She has a very simple interface and comes with a small number of practical options that can help us quickly understand system performance.
However, sometimes it may be difficult to find an application or process that occupies a large amount of system resources. Because the top command itself does not help us highlight programs that eat too much CPU, memory, or other resources.
To achieve this goal, we will introduce Glances, a super powerful system monitoring program. She can automatically highlight programs that use the highest system resources and provide as much information as possible for Linux/Unix servers.
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
The following is a Glances usage:
Install Glances on Linux/Unix systems
Although the tool is released late, you can still install it through the EPEL software source in the Red Hat system. Run the following command on the terminal:
For RHEL/CentOS/Fedora releases
# Yum install-y glances
For Debian/Ubuntu/Linux Mint release
$ Sudo apt-add-repository ppa: arnaud-hartmann/glances-stable
$ Sudo apt-get update
$ Sudo apt-get install glances
How to use Glances
First, enter the following command in the terminal:
# Glances
Press 'Q' ('esc 'and 'Ctrl-c') to exit the Glances terminal. Here is another screenshot taken from CentOS6.5:
The default refresh frequency of Glances is 1 (second), but you can manually define the refresh frequency by specifying parameters on the terminal.
# Glances-t 2
Color meaning in Glances
Glances uses several colors to represent the status:
Green: OK (everything works)
Blue: CAREFUL (note)
Purple: WARNING (WARNING)
Red: CRITICAL (severe)
The threshold value can be set in the configuration file. Generally, the default threshold value is (careful = 50, warning = 70, critical = 90 ).
We can customize the configuration file (in/etc/glances. conf by default) as needed.
Glances options
In addition to many command line options, Glances also provides more shortcut keys for switching the output information options during its running. The following are some examples:
A? Automatic process sorting
C? Sort processes by CPU percentage
M? Sort processes by memory percentage
P? Sort processes alphabetically by process name
I? Sort processes by read/write frequency (I/O)
D? Display/hide disk I/O statistics
F? Show/Hide file system Statistics
N? Display/hide network interface statistics
S? Display/hide sensor statistics
Y? Display/hide hard disk temperature statistics
L? Show/hide logs)
B? Switch network I/O units (Bytes/bits)
W? Delete warning logs
X? Delete warnings and severe logs
1? Switch the global CPU usage and the usage of each CPU
H? Show/hide this help screen
T? View network I/O in combination
U? Browsing network I/O in accumulative form
Q? Exit (either 'esc 'or 'Ctrl & C)
Remote use of Glances
You can even use Glances to monitor remote systems. To use 'glances' in a remote system, run the 'glances' (-s start server/client mode) command on the server.
# Glances-s
Define the password for the Glances server
Password:
Password (confirm ):
Glances server is running on 0.0.0.0: 61209
Note: after you run the 'glances' command, she will ask you to set a password for the glances server.
After setting, you will see the message "Glances server is running on 0.0.0.0: 61209" (the Glances server is running on port 61209 of 0.0.0.0.
After the Glances server is started, run the following command locally to specify the server IP address or host name as a link.
Note: '127. 16.27.56 'here is the IP address of my Glances server.
# Glances-c-P 172.16.27.56
The following are some things you must know when using server/client mode:
* In server mode, you can set the binding address through '-B address' or bind the listening TCP port through'-p port '.
* In Client mode, you can specify the server port through the same '-p port'
* The default binding address is 0.0.0.0, but this will listen to the specified ports of all network interfaces.
* In server/client mode, the limited threshold value is determined by the server settings.
* You can also use '-P password' on the command line to set a password for the server.
|
* In server mode, you can set the binding address through '-B address' or bind the listening TCP port through'-p port '. * In Client mode, you can specify the server port through the same '-p port' * The default binding address is 0.0.0.0, but this will listen to the specified ports of all network interfaces. * In server/client mode, the limited threshold value is determined by the server settings. * You can also use '-P password' on the command line to set a password for the server. |
Summary
Glances is a tool that provides excessive information on system resources for most users. However, if you are a system administrator who wants to quickly obtain the overall state of the system from the command line, this tool is definitely a must-have tool for you.
Translator's note
Do not mix the glances (tool in this article) and glance (an OpenStack tool) packages.
Glances in the Ubuntu official Extra source cannot be used properly due to the movement of the python library, but it can be temporarily repaired by creating a soft link:
Sudo ln-s/usr/lib/python2.7/dist-packages/glances/usr/share/pyshared/glances