Real Time Linux Server monitoring with GLANCES
Glances is an open source real time Linux server monitoring system that aims at providing as much as information possible in as minimum as space possible. Glances is like top command but more refined with many more features & much more real time information of your Linux system.
Glances provide information regarding memory, CPU, Disk IO , file system, Uptime, processes, interfaces, alerts & many other system information.
One of the best features of Glances is that it can work in server/client mode. We can perform remote monitoring of the systems using a Web interface or through terminal/CLI & we can also export stats to a file.
In this tutorial, we are going to discuss the installation of glances monitoring tool on CentOS/RHEL as well Ubuntu machines & also how to use it for real time Linux server monitoring of our system.
Recommended Read: Complete guide to install Zabbix on CentOS7
Also Read: Easy guide to setup Nagios monitoring using SSH (check_by_ssh)
Prerequisites
Glances is written in python, so it requires that we have python installed on machines. If its not installed, we can install it using the following command,
On CentOS
$ sudo yum install python python-devel
On Ubuntu
$ sudo apt-get install python python-dev
Also read our detailed article on How to install python 3.6 on Linux machines.
Installation of Glances monitoring
There are three ways with which we can install glances on CentOS/RHEL & Ubuntu systems. Either using system repositories or we can use pip (python package manager) or we can also use an official script for installation. PIP method & official script method is same on both Ubuntu & CentOS/RHEL.
Its recommended that we either use PIP or Official script to install Glances as repositories might hold older versions but none the less, let’s discuss all methods one by one…
CentOS/RHEL installation
On CentOS, glances packages are available with the EPEL repository. Install EPEL repository with the following command on your machine,
RHEL/CentOS 8
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
RHEL/CentOS 7
$ sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
RHEL/CentOS 6 (64 Bit)
$ sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RHEL/CentOS 6 (32 Bit)
$ sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Once installed, run the following command to install glances tool,
$ sudo yum install glances
This will install glances tool on your machine.
Ubuntu Installation
Glances is available with the default Ubuntu repositories, so we can install glances easily on Ubuntu systems with the following command,
$ sudo apt-get install glances
Installation of Glances monitoring tool using PIP
If you have PIP installed on your system, than install glances on both CentOS/RHEL & Ubuntu systems using the following command,
$ pip install glances
If you don’t have PIP installed on your machine, read our detailed article on How to install PIP on Linux systems.
Installation of Glances monitoring tool using the Official script
This is another way with which we can install the latest version of glances on our CentOS/RHEL & Ubuntu systems. Open terminal & execute the following command,
$ sudo curl -L https://bit.ly/glances | /bin/bash
This will automatically install the glances on our system. We can also use following command in place of the one mentioned above, both achieve the same goal,
$ sudo wget -O- https://bit.ly/glances | /bin/bash
Using Glances in standalone mode
Once the glances tool has been installed on our machine, we can use it for real time Linux monitoring by opening the terminal & running the following command,
$ glances
Running Glances remotely
To remotely monitor the server from another machine, open terminal & run the following command,
$ glances -s
you should get the following output
Glances server is running on 0.0.0.0:61209
Now open the remote machine from where you want to monitor the server & run the following command from the terminal,
$ glances -c 192.168.1.100
where 192.168.1.100 is IP address of the server to be monitored.
Running Glances in Web server mode
To start the Glances in webserver mode, execute the following command from terminal,
$ glances -w
Once done, open the web browser & enter the following URL to access the Glances monitoring using web browser,
This will open the glances monitoring page for our server.
This was our tutorial on Installation of Glances tool on CentOS/RHEL machines which is used as a real time Linux server monitoring tool. Please do leave your comments/questions in the comment box below.