Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Linux system performance monitoring tool Glances

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you what the Linux system performance monitoring tool Glances is like, the content is concise and easy to understand, it can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

1. Introduction of Glances

Glances is a development based on the python language that provides the ability to monitor and analyze performance data for linux or UNIX performance. Glances displays important system information on the user's terminal and updates it dynamically, so that the administrator can keep abreast of the use of system resources in real time, while dynamic monitoring does not consume a lot of system resources, such as CPU resources, which is usually less than 2%. Glances updates the data every two seconds by default. At the same time, glances can also capture the same data to a file to facilitate later analysis and graphics of the report. The file formats supported are .csv spreadsheet format and html format.

Github address: https://github.com/nicolargo/...

The glances tool has the following functions:

CPU utilization rate

Memory utilization

Kernel statistics and run queue information

Disk Icano speed, transfer and read / write ratio

Disk adapter

Network Icano speed, transmission and read / write ratio

Page monitoring

Process monitoring-the process that consumes the most resources

Computer information and system resources

Effect picture

II. Installation mode of glances

Source code installation

Pip command installation

Yum installation

Source code installation is complex, and you may encounter dependency problems that are not easy to solve; both pip installation and yum installation are optional. Documentation manual: https://glances.readthedocs.i...

Third, install glances

Glances is generally integrated into the official software source of most Linux distributions, and can be installed directly using the system's package manager (such as apt-get, yum):

Sudo apt-get install glancesyum install epel*-yyum-y install glances

Of course, you can also use Python's package manager (pip command) to install:

Pip install glances

Installation of temperature monitoring tools

Lm_sensors software can help us to monitor the motherboard, CPU working voltage, fan speed, temperature and other data. These data can usually be seen in the BIOS of the motherboard. When we can monitor the temperature change of the CPU through lm_sensors at any time while the machine is running, we can prevent the protection from burning out because the CPU is overheated. The data monitored by lm_sensors software can be called by glances and displayed. _

Yum-y install lm_sensors

In fact, the installation of these open source software is very simple, basically 100% stupid, there is no big problem.

IV. The use of Glances

Glances is marked with four colors that indicate different levels of urgency:

Green: OK

Blue: CAREFUL

Purple: WARNING

Red: CRITICAL

Green indicates good performance; (in this case, CPU utilization, disk space utilization and memory utilization are less than 50%, and system load is less than 0.7).

Blue indicates that there are some minor problems with system performance, and users should start to pay attention to system performance. (at this point, the CPU utilization, disk space utilization and memory utilization are between 50% and 70%, and the system load is between 0.7 and 1).

Magenta indicates a performance alarm, and measures should be taken, such as backing up data. (in this case, the CPU utilization, disk space utilization and memory utilization are between 70% and 90%, and the system load is between 1 and 5).

Red indicates serious performance problems and possible downtime. (in this case, CPU utilization, disk space utilization and memory utilization are greater than 90%, and system load is greater than 5).

How to use glances

Glances is a command line tool that includes the following command options:

-b: displays the network connection speed Byte/ seconds

-B @ IP | host: bind server-side IP address or host name

-c @ IP | host: connect to the glances server

-C file: setting profile defaults to / etc/glances/glances.conf

-d: close the disk Ihop O module

-e: display sensor temperature

-f file: sets the output file (format is HTML or CSV)

-m: close the mounted disk module

-n: close the network module

-p PORT: set the running port to 61209 by default

-P password: set the client / server password

-s: set glances operation mode to server

-t sec: sets the interval between screen refreshes (in seconds). The default value is 2 seconds. Value range: 1: 32767

-h: displays help information

-v: displays version information

Description of the glances work interface:

At the top of the figure is the usage of CPU, Load (load), Mem (memory usage), and Swap (swap partition). In the middle and upper part of the figure is the use of network interfaces and Processes (processes). It usually includes the following fields:

VIRT: virtual memory size

RES: the value of physical memory consumed by the process

% CPU: CPU usage occupied by the process

% MEM: percentage of physical memory and total memory consumed by the process

PID: process ID number

USER: the user name of the process owner

TIME+: the total CPU time taken by the process after it was started

IO_R and IO_W: read and write rate of the process

NAME: process name

NI: process priority

S: process state, where S is dormant, R is running, and Z is dead.

In addition, glances can run the tool interactively, and users can use the following keyboard shortcuts:

H: show help information

Q: leave the program and exit

C: sort system processes according to CPU real-time load

M: sort system processes according to memory usage

I: sort the process of the system according to the usage of Ihamo

P: sort by process name

D: show disk read and write status

W: delete log files

L: show log

S: display sensor information

F: display system information

1: take turns to show the usage of each CPU kernel

5. Glances's Cramp S model

Glances also supports Cramp S mode monitoring, the monitored machine runs the server side, and the monitoring side runs the client side to realize remote monitoring, and both ends can install Glances services.

Server startup

The port used by the server is 61209 by default, and the startup command is as follows:

Glances-s-B 192.168.1.253glances server is running on 192.168.1.253 purl 61209

Client access

Glances-c 192.168.1.253

You can also use a user name and password for access. The default user name is glances, and you can change it with-- username if you want to change it. The following is the official text:

In client/server mode, limits are set by the server side.

You can set a password to access to the server using the-- password. By default, the username is glances but you can change it with-- username.

Glances-s-usernameDefine the Glances server username: testDefine the Glances server password (test username): Password (confirm): Do you want to save the password? [Yes/No]: YesGlances XML-RPC server is running on 0.0.0.0:61209

The client connects as follows:

Glances-c 192.168.1.253-username test

VI. Glances's WebServer mode

In glances's WebServer mode, the client can obtain the running status of the remote server only through browser access. You only need to install the Bottle module of Python:

Pip install bottle

After the installation is successful, use the glances-w command to turn on WebServer mode.

The client uses a browser to access http://SERVER_IP:61208/ to enter the monitoring interface.

Its WEB mode can also be seen on mobile phones, as shown below.

Source official documentation

VII. Other advanced applications

Export the data in CSV format with the following command:

Glances-export-csv / tmp/1.csv

Glances can also cooperate with InfluxDB, Grafana and other open source software to build a monitoring platform, which, like other monitoring software, can form real-time and graphical data display.

The above is what the Linux system performance monitoring tool Glances is like, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report