Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Glances, a Linux system monitoring tool

Shulou Source: shulou.com Published: 2022-06-01 13:52:36 10月03日 Update

This article is about how to use Glances, a Linux system monitoring tool. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Glances is a cross-platform command line system monitoring tool written by Python and using psutil libraries to grab information from the system based on curses development. With Glances, we can monitor CPU, average load, memory, network traffic, disk Imax O, other processors and file system space utilization.

How to install Glances

Glances is not installed by default. Here's how to install it in a commonly used linux distribution:

# Ubuntu / Debian$ sudo apt install-y glances# CentOS [root@localhost ~] # yum-y install epel-release [root@localhost ~] # yum-y install glances

You can also use the snap package manager to install glances:

# snap install glances

In addition, because Glances is written in Python, you can also install it using the pip package manager:

# pip3 install glances monitors system information in stand-alone mode

Starting Glances to monitor the local system is a piece of cake:

[root@localhost ~] # glances

You can see some system metrics, starting with the topmost hostname and uptime in the upper right corner of the terminal. Below it, you can view other system metrics, such as CPU and memory utilization, network bandwidth, running processes, disk capacity, and so on. If you want to view these statistics in a Web browser, use the-w option. You need to install bottle first, or the following error will occur:

[root@localhost] # glances-wBottle module not found. Glances cannot start in web server mode.

Use pip3 to install bottle below:

[root@localhost ~] # pip3 install bottle

Let's add the-w option again to start:

[root@localhost ~] # glances-wGlances Web User Interface started on http://0.0.0.0:61208/

Then enter the ip address of the server in the browser, and the port is port 61208 provided in the above output. You can configure the password to allow only authorized users to use it.

[root@localhost] # glances-w-- passwordDefine the Glances webserver password (glances username): Password (confirm): Do you want to save the password? [Yes/No]: yesGlances Web User Interface started on http://0.0.0.0:61208/

The default user name is: glances

Monitor system information in server mode

The Glances command can also be used to monitor remote hosts. Simply add the-s option to initialize Glance in server mode, as shown below.

[root@localhost] # glances-sGlances XML-RPC server is running on 0.0.0.0purl 61209

In the client PC, you can connect using glances-c server-ip:

[root@localhost ~] # glances-c 192.168.43.131 how to use Glances commands to monitor how to use Glances commands to monitor Glances alert types

By using color codes when displaying system metrics, Glances can more easily identify and narrow the scope of problems. Here is an explanation of color usage:

GREEN: OK (everything is fine) BLUE: CAREFUL (need to note) VIOLET: WARNING (warning) RED: CRITICAL (critical error)

By default, the threshold parameters are:

Careful=50warning=70critical=90

These parameters can be modified in the / etc/glances/glances.conf file.

Thank you for reading! This is the end of this article on "how to use Glances, a Linux system monitoring tool". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Systems monitoring monitoring information commands tools conditions metrics servers patterns services hosts memory content parameters files more browsers users monitoring system Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Microsoft Redmi Linux Shulou Tech Info