How to Install Glances on CentOS 8

Glances is a cross-platform monitoring tool that aims to present a large amount of monitoring information through a curses or Web-based interface.

Features

  • CPU related information such as idle, iowait, usage, and more
  • Memory-related information such as usage, free, SWAP, and more.
  • Network usage information based on interfaces.
  • Disk usage information.
  • Lists processes resources used (sortable by resources).

Update the System.

yum update

Enable the EPEL Repository,

yum install epel-release

Output:

[root@vps ~]# yum install epel-release
Last metadata expiration check: 1:34:47 ago on Saturday 28 August 2021 01:14:12 PM EDT.
Dependencies resolved.
===============================================================
 Package           Arch        Version       Repository   Size
===============================================================
Installing:
 epel-release      noarch      8-11.el8      extras       24 k

Install required packages.

yum install python3 python3-jinja2 python3-psutil python3-setuptools hddtemp python3-pip lm_sensors

And check again if there are any updates available,

yum update

Install Glances

yum install glances

Output:

[root@vps ~]# yum install glances
Extra Packages for Enterprise  1.7 MB/s | 931 kB     00:00    
Extra Packages for Enterprise   35 MB/s |  10 MB     00:00    
Last metadata expiration check: 0:00:01 ago on Saturday 28 August 2021 03:15:30 PM EDT.
Dependencies resolved.
===============================================================
 Package            Arch   Version             Repo       Size
===============================================================
Installing:
 glances            noarch 3.1.4.1-7.el8       epel      1.3 M
Installing dependencies:
 python3-future     noarch 0.18.2-2.el8        epel      790 k
 python3-pip        noarch 9.0.3-19.el8        appstream  20 k
 python3-psutil     x86_64 5.4.3-10.el8        appstream 373 k
 python3-setuptools noarch 39.2.0-6.el8        baseos    163 k
 python36           x86_64 3.6.8-2.module_el8.4.0+790+083e3d81
                                               appstream  19 k
Enabling module streams:
 python36                  3.6                                

Add a firewall rule so that the web console would be accessible,

firewall-cmd --zone=public --add-port=61208/tcp --permanent
firewall-cmd --reload    

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

  • Standalone – To monitor a single system and view results in the terminal.
  • Web – To monitor a single system and view results in web UI.

Run Glances in Standalone Mode

If you want to monitor your local machine, open a console/terminal and simply run:

glances

You will see the output something like below:

images

Run Glances in Web Mode

If you want to remotely monitor your machine, from any device with a web browser, just run the glances with the -w option:

For this to work, you need to install the Bottle module -- you can install this module using pip

Note: For Python3 you need to use pip3 command to work.

pip3 install bottle

and then run the following command to remotely monitor a machine

glances -w

Output:

[root@vps ~]# glances -w
Glances Web User Interface started on http://0.0.0.0:61208/

Now open the web browser using IP or FQDN on port 61208.

Web mode will only be active if the above command is running. You can quit the web mode by stopping the web mode with Ctrl + C.

images

Done.