How to Install Glances to Monitor Linux Systems

Ubunto and Centos

Monitoring a system is essential for keeping things running smoothly. Glances is a Python-based tool which provides information on several aspects of the system, like operating processes, I/O, memory and so forth. It may display the information on a terminal and also has a web interface which can be obtained from any device. In addition, you may use it to track a remote system via its API or its various ports. In the following article, we will see how to set up and utilize Glances to track local in addition to remote systems.

Glances monitors following things on system.

CPU, Memory and LOAD

Process list

Network interface

Disk I/O, IRQ / Raid

Sensors

Filesystem (and folders)

Docker

Alert

System info

Uptime

Step 1 – Glances Installation

Glances provide installation scripts for Linux system. You can use one of the following methods to install Glances on your system.

Using Package Manager:

1

2

sudo apt install glances# On Debian Based Systems

sudo yum install glances# On RedHat Based Systems

If Glances is not available under package manager for your operating system, Use following installation script provided by Glances official team.

Using curl:

1

curl-Lhttps://bit.ly/glances | /bin/bash

Using wget:

1

wget-O-http://bit.ly/glances | /bin/bash

After installing Glances you can use this tool in 3 modes.

Standalone – To monitor single system and view results in terminal.

Web – To monitor single system and view results in web ui.

Client Server – To monitor multiple systems

Step 2 – Run Glances in Standalone Mode

After installation completed, You will get glances command available on your system. You can run glances in standalone mode using command line access. This will show all the details in current terminal. Let’s watch the output of glances command:

1

glances

You will see the output something like below:

Step 3 – Run Glances in Web Mode

Now, open a browser and type http://<server-ip>:61208 where <server-ip> is the public IP address/hostname of the server. You should be able to see the stats displayed in a similar format as shown in the terminal. You can even access the page with a mobile browser since the page displayed is responsive.

To change the refresh rate of the page to a faster or slower value than the default rate, just append the date at the end of the URL. For example, if you want the values to refresh after every 5 seconds, then the URL will be http://<server-ip>:61208/5.

1

glances-w

Step 4 – Run Glances in Client-Server Mode

If you want to monitor a system remotely, you should install Glances on the local as well as the remote system. Once you have done so, run this command on the remote system:

1

glances-s

After start Glances in server mode on each Linux system. Go to your client system and connect to Glances system with IP address. Use the following command to access Glances on the client. Change 192.168.10.100 with remote system IP. Also, make sure to open Glances port on remote system.

1

glances-c192.168.10.100

This will show you the resource utilization of the remote system.

Configuring Glances

Glances allows you to configure its behavior through a glances.conf configuration file. For Linux systems, you can save this file either in ~/.config/glances or the /etc/glances directory. If either of these directories are not present in your system, you must create them manually.

The coloring scheme of glances is explained above. Now, if you want to trigger the warnings at some custom values rather than the default values, each section must be stated explicitly in the glances.conf file. For example, if you want to specify some custom alert values for CPU usage, then you can specify the values under the [cpu] section as follows.

1

2

3

4

5

6

7

8

9

10

11

12

13

[cpu]

user_careful=50

user_warning=70

user_critical=90

iowait_careful=50

iowait_warning=70

iowait_critical=90

system_careful=50

system_warning=70

system_critical=90

steal_careful=50

steal_warning=70

steal_critical=90

You can change the values according to your preferences. Similarly, you can customize other sections such as memory, I/O, network in the configuration file. To see the various sections that you can use, Glances provides a sample template configuration file that you can see here.