Glances System Monitor is free, an open-source command-line tool for process monitoring, system resources such as CPU, Disk I/O, File System, Load Average, Memory, Network Interfaces and processes. Glances are built with Python language. Glances support cross-platform monitoring, which can be used in conjunction with a web-based interface.
One of the excellent features Glances supports is the ability to set thresholds in the program. You can set careful, warning, and critical in the configuration file, which will then relay information in colors that can show alerts to systems resources bottlenecks, system resources issues, and much more. Glances, by default, comes with a pre-set list of colors, but you can modify and add additional configs.
Example of terminal layout of Glances in action.
In the following tutorial, you will learn how to install and use Glances on Debian 11 Bullseye.
Table of Contents
- Recommended OS: Debian 11 Bullseye
- User account: A user account with sudo privilages or root access (su command).
- Required Packages: python, pip, psutils
Updating Operating System
Update your Debian 11 operating system to make sure all existing packages are up to date:
sudo apt update && sudo apt upgrade
Root or Sudo Access
By default, when you create your account at startup with Debian compared to other distributions, it does not automatically receive sudoers status. You must either have access to the root password to use the su command or visit our tutorial on How to Add a User to Sudoers on Debian.
Install Glances System Monitor
Before installing Glances, you need to make sure you have installed Python 2.7 or higher along with psutil 5.30 or better. If you do not have either installed, run the following command:
sudo apt install python3 python3-dev python3-jinja2 python3-psutil python3-setuptools hddtemp python3-pip lm-sensors -y
This will install the most up-to-date dependencies using Debian 11’s default repository.
To install Glances System Monitor on Debian, you need to install it using PIP3. To do this, execute the following command:
sudo pip3 install glances
Verify the installation by checking the Glances build:
Glances v188.8.131.52 with PsUtil v5.8.0 Log file: /root/.local/share/glances/glances.log
How to use Glances System Monitor
Once you have installed the program, you need to type the following terminal command to bring it up.
Note, you will notice the –theme-white flag added to the command, given Debian default terminal background is white; if you load it up with the default glances command, it will be tricky to read unless you have switched to default white background to black.
Example using default glances command:
Example using the glances –theme-white command:
To exit the Glances program, you can use the following command.
You can change the time interval of Glance updating, the default is 1, but you can change this as an example:
glances -t 3
To bring up the help command, enter the following.
Alerts in Glances System Monitor
As mentioned at the start of the tutorial, Glances has the color for alerts. The following describes what they are.
- GREEN: OK (good)
- BLUE: CAREFUL (attention)
- VIOLET: WARNING (alert)
- RED: CRITICAL (critical)
The thresholds that default settings are as follows.
The default configuration can be changed. To do this, open up a text editor on the file /etc/glances/glances.conf. But firstly, let’s make a backup of the original configuration file for safekeeping.
sudo cp /usr/local/share/doc/glances/glances.conf /usr/local/share/doc/glances/glances-bkup.conf
Next, using the nano text editor, open up the main configuration file:
sudo nano /usr/local/share/doc/glances/glances.conf
Scroll down (Line 37), and you will start to see all the settings you can change.
Adjust the numbers, then CTRL+O to save, then CTRL+X to exit. The defaults should be fine for most user setups; only edit if you strongly disagree with the values.
Glances System Monitor Commands
You can use the following list commands in Glances to configure, find, and show what you are looking for.
- a – Sort processes automatically
- c – Sort processes by CPU%
- m – Sort processes by MEM%
- p – Sort processes by name
- i – Sort processes by I/O rate
- d – Show/hide disk I/O stats ols
- f – Show/hide file system statshddtemp
- n – Show/hide network stats
- s – Show/hide sensors stats
- y – Show/hide hddtemp stats
- l – Show/hide logs
- b – Bytes or bits for network I/Oools
- w – Delete warning logs
- x – Delete warning and critical logs
- x – Delete warning and critical logs
- 1 – Global CPU or per-CPU stats
- h – Show/hide this help screen
- t – View network I/O as combination
- u – View cumulative network I/O
- q – Quit (Esc and Ctrl-C also work)
Run Glances System Monitor In Web Browser
You can monitor Glances in your favorite web browser. All dependencies are installed as default. To initiate the browser function in the program, do the following.
Note that you will most likely see in the terminal display “Glances Web User Interface started on http://0.0.0.0:61208” when entering this command. This may look a little confusing, and it is actually using the server’s IP address.
You can set a password for the web-based monitor by typing the following command.
glances -w --password
To open the web browser for the program, enter your IP server address with the default port 61209 as an example.
For your primary client, you can keep glances running in the background with the following command.
glances -w &
The above creates a background running process. Now you must disown the current state.
If you need to kill the processors in background mode, type the following to kill all active glances sessions.
Run Client-Server Mode
Another great feature of the Glances program is that it provides client-server architecture. This means you can run glances on multiple remote servers and connect them to your primary client. All servers must have glances installed.
Login to a remote server, start the glance program in server-side mode.
After you have finished starting server-side monitoring on all the required servers you need, go to your client system and connect to the system’s IP address running the server-client mode with the following command.
glances -c server-IP-address
How to Update Glances using PIP3
Given Glances was installed using PIP, and you will need to check for updates using the following command periodically:
pip3 install --upgrade glances pip3 install --upgrade psutil
This will upgrade the main components. However, it is recommended to run the following command that covers everything:
pip3 install --upgrade glances[all]
And that is it; if an update is available, it will upgrade; if not, the same version will stay put.
How to Remove (Uninstall) Glances System Monitor
To remove Glances off your Debian system, use the following PIP3 removal command:
sudo pip3 uninstall glances
Found existing installation: Glances 184.108.40.206 Uninstalling Glances-220.127.116.11: Would remove: /usr/local/bin/glances /usr/local/lib/python3.9/dist-packages/Glances-18.104.22.168.dist-info/* /usr/local/lib/python3.9/dist-packages/glances/* /usr/local/share/doc/glances/AUTHORS /usr/local/share/doc/glances/CONTRIBUTING.md /usr/local/share/doc/glances/COPYING /usr/local/share/doc/glances/NEWS.rst /usr/local/share/doc/glances/README.rst /usr/local/share/doc/glances/glances.conf /usr/local/share/man/man1/glances.1 Proceed (y/n)?
Type Y, then press ENTER KEY to proceed with the uninstallation.
Comments and Conclusion
Glances System Monitor is a step above the default “top” package for monitoring system resources and processors. This package is ideal, especially if you want a better overview of your system. It covers much more information and presents it in color codes to signal what the data in front of you means and how it affects your server.
The extra benefit of remote monitoring makes this one of the more popular options for simple server monitoring. It continues to get better with an active development continuing to this day.