Install & Use Glances to monitor Ubuntu Server.

Whether you're a system administrator or a casual user, you're probably familiar with TOP and its more colorful, feature-rich cousin, HTOP. But if you're looking for an even more powerful, flexible, and user-friendly system monitoring tool, Glances is the perfect choice! 🚀

Install & Use Glances to monitor Ubuntu Server.
Image credit: Unknown. Please contact us if you are the owner.

Glances is a powerful, cross-platform command-line system monitoring tool designed to provide a comprehensive overview of system performance in real-time. Unlike traditional tools such as top and htop, Glances goes beyond just process monitoring by displaying a wide range of system metrics, including CPU usage, memory consumption, disk I/O, network activity, file system usage, sensor data, and even container statistics.

With its user-friendly ncurses-based interface, Glances allows users to quickly assess system health at a glance, making it an excellent tool for both casual monitoring and advanced system diagnostics. Additionally, Glances includes a built-in web server, enabling users to access real-time system statistics remotely from any device with a web browser.

Install via APT

On Debian/Ubuntu-based distributions, you can use the following command:

$ sudo apt update

$ sudo apt install glances

Install via Snap


You can also install the latest Glances using the snap package:

$ sudo snap install glances

pipx is a Python tool that allows you to install and run Python applications in isolated environments. It helps avoid dependency conflicts by ensuring each package runs in its own virtual environment, separate from system-wide or user-installed Python packages.

Install pipx if you haven't already:

$ sudo apt update
$ sudo apt install pipx
$ pipx ensurepath


Install Glances using pipx:

$ pipx install glances



Install via Docker (For Advanced Users)

Installing Glances via Docker is useful when you want isolation, portability, and ease of deployment. Instead of installing the app directly on your system, Docker runs it inside a lightweight container.

$ docker run --rm -it --pid host nicolargo/glances


Using Glances - Standalone

Simply run the following command to display detailed information about your system:

$ glances


It should display detailed information about your system, as shown in the image below:

Glances

Searching/Filtering Processes

Simply press the Enter key to search for a specific process.
A search box will appear, as shown below:


You can search for a process by name or use a regular expression to refine your search. Additionally, you can filter by other parameters such as the username or command-line arguments.
For example, to find processes belonging to the root user, enter username:root.

To exit the filtered process list and return to the main Glances page, simply press the capital E key.

Server/Client Mode

If you want to access data from another system through a terminal without using SSH, use server and client mode.

Execute the following command on the remote system:

$ glances -s
...
..
.
Glances XML-RPC server is running on 0.0.0.0:61209


This will start Glances in server mode, allowing you to access system data remotely.

You can then connect to the server from another terminal or system by running:

$ glances -c SERVER_IP


This will enable you to monitor the remote system's stats in real time.
Replace SERVER_IP with the IP address or the hostname of the server.


If you don't want to log in to the server, using Glances in server-client mode is a great alternative. However, to obtain performance data from the remote system, both the remote (server) and client computers must have Glances installed.

Note: Open port 61208 using the command
sudo ufw allow 61208/tcp
sudo ufw reload


Web server Mode


Furthermore, Glances has a "webserver mode" that allows you to monitor system performance performance remotely through a web browser.

To enable this mode, launch Glances in web server mode on the remote system with the following command:

$ glances -w


The preceding command will occupy the terminal, and closing it will also stop the webserver. As a result, you can use &– to run it in the background for the current session.

$ glances -w &

Output

Glances Web User Interface started on http://0.0.0.0:61208/


This will start a web server that you can access from any device with a web browser. By default, it runs on port 61208.

Open your web browser and type-

http://SERVER-IP:61208


Replace SERVER-IP with the IP address of the machine in which you have installed glances.

To adjust the refresh rate of the web interface, simply append the desired interval (in seconds) to the end of the URL.

http://SERVER-IP:61208/4


This allows you to speed up or slow down the refresh rate based on your preference.

Protect your Web server with a login/password

To enhance security, you may want to password-protect Glances' web mode so that only authorized users can access it.

By default, the username is: glances.
To set a password, run the following command:

$ glances -w --username glances --password

Define the Glances webserver password (glances username): 
Password (confirm): 
Do you want to save the password? [Yes/No]: y
Glances Web User Interface started on http://0.0.0.0:61208/


You will be prompted to enter and confirm a password. Once set, users will need to authenticate before accessing the web interface.

Configuring Glances



Glances' behavior can be customized using the glances.conf configuration file.
A template is available in the /usr/share/doc/glances/ or /usr/local/share/doc/glances/ directory on Unix-like systems.

You can place your own glances.conf file in one of the following locations:

- ~/.config/glances/ (User-specific configuration)
- /etc/glances/ (System-wide configuration)
- /usr/share/doc/glances/ (Default documentation directory)

If these directories do not exist on your system, you must create them manually.

To modify warning thresholds and trigger alerts at custom values instead of using the defaults, you must explicitly define each section in the glances.conf file.

For example, to set custom alert values for CPU usage, add the following to the [cpu] section:

[cpu]
disable=False

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



We hope you found these insights useful! Glances offers powerful, real-time system monitoring, making it easy to track and manage your system's performance! 🚀

Keep Us Caffeinated  ⦿ ⦿
Icon Join our 32K+ readers