How to Use Glances to Monitor System on Ubuntu

Glances is a cross-platform command-line text-based tool to monitor your system. It is written in Python language and uses the psutil library to get information from the system. Using it you can monitor CPU, Load Average, Memory, Network Interfaces, Disk I/O, File System spaces utilization, mounted devices, total number of active processes and top processes. There are many interesting options available in Glances. One of the main features is that you can set thresholds (careful, warning and critical) in a configuration file, and information will be shown in colors which indicates the bottleneck in the system.

  • the average CPU load
  • total number of processes like active, sleeping processes, etc.
  • total memory information like RAM, swap, free memory, etc.
  • CPU information
  • Network download and upload speed of connections
  • Disk I/O read/write speed details
  • Currently mounted devices’ disk usages
  • Top processes with their CPU/memory usages

Installing Glances on Ubuntu is easy, as it is available on Ubuntu’s repository. You can install Glances by running the following command.

sudo apt-get install glances

After installation has been finished, you can launch Glances by running the following command:

glances

You will see an output like the following:

glances monitor system output

Press ESC or “Ctrl + C” to quit from the Glances terminal.

By default, the interval time is set to 1 second, but you can define the custom interval time while running glances from the terminal.

To set the interval time to 5 seconds, run the following command:

glances -t 5

Glances color code meanings:

  • GREEN : OK
  • BLUE : CAREFUL
  • VIOLET : ALERT
  • RED : CRITICAL

By default, Glances thresholds set is: careful=50, warning=70, critical=90. You can customize the threshold by using the default configuration file glances.conf located at the “/etc/glances/” directory.

Glances provides several hot keys to find output information while it is running.

Below are the list of hot keys.

m : sort processes by MEM%
p : sort processes by name
c : sort processes by CPU%
d : show/hide disk I/O stats
a : sort processes automatically
f : show/hide file system statshddtemp
i : sort processes by I/O rate
s : show/hide sensors’ stats
y : show/hide hddtemp stats
l : show/hide logs
n : show/hide network stats
x : delete warning and critical logs
h : show/hide help screen
q : quit
w : delete warning logs

You can also monitor remote systems using Glances. To use it on a remote system, use the following command:

glances -s

You will see an output like the following:

glances monitor remote system server

You will see Glances running on port 61209.

Now, go to the remote machine and execute the following command to connect to a Glances server by specifying the IP address as shown below. For example, 192.168.1.10 is your Glances server IP address.

glances -c -P 192.168.1.10

Glances is a very useful tool for every Linux system administrator. Using it, you can easily monitor your Linux system in less time. Feel free to comment if you have any questions.

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.