FedoraRHEL Based

How To Install Glances on Fedora 42

Install Glances on Fedora 42

Monitoring system performance is crucial for maintaining optimal functionality and troubleshooting issues in Linux environments. Glances provides an elegant solution for system administrators, Linux enthusiasts, and DevOps engineers who need to keep track of their system’s vital signs. This comprehensive guide explores how to install and configure Glances on Fedora 42, equipping you with the knowledge to effectively monitor your system’s performance.

What is Glances?

Glances is a powerful, open-source cross-platform monitoring tool written in Python that provides real-time insights into your system’s performance metrics. Unlike traditional monitoring tools such as top or htop, Glances delivers a more comprehensive overview of system resources in a single screen interface.

This versatile monitoring solution displays crucial information about:

  • CPU usage and load averages
  • Memory utilization (RAM and swap)
  • Disk I/O operations and storage capacity
  • Network interface traffic statistics
  • Running processes with resource consumption details
  • Temperature sensors and hardware readings
  • Container statistics (Docker, LXC)

One of Glances’ standout features is its intuitive color-coded interface that helps you quickly identify potential issues. The color scheme follows a logical progression: green for normal operation, blue for moderate usage, violet for high usage, and red for critical levels. By default, Glances sets thresholds at 50% for caution, 70% for warning, and 90% for critical states.

Prerequisites for Installing Glances on Fedora 42

Before installing Glances on your Fedora 42 system, ensure you have the following prerequisites in place:

System Requirements:

  • A functioning Fedora 42 installation
  • Sufficient disk space for installation (minimal requirements)
  • Internet connection to download packages
  • Administrator (root) access or sudo privileges

Required Dependencies:

  • Python 3 (Fedora 42 comes with Python 3 pre-installed)
  • python3-pip package for managing Python modules
  • Additional packages for extended functionality

To check your current Python version, run:

python3 --version

Ensure your system is up-to-date before proceeding with the installation:

sudo dnf update -y

Installation Methods Overview

There are several methods to install Glances on Fedora 42, each with its own advantages. This guide covers four primary installation approaches:

  1. DNF Package Manager: The simplest and most straightforward method using Fedora’s native package manager
  2. PIP Installation: Using Python’s package manager for the latest version and additional features
  3. PipX Installation: For a clean, isolated Python application installation
  4. Source Code Installation: Installing directly from the GitHub repository for the most recent development version

Each installation method has its strengths:

  • DNF provides system integration with automatic updates
  • PIP offers more flexibility with feature selection
  • PipX maintains isolation from system Python packages
  • Source installation gives access to the latest development features

Choose the installation method that best fits your requirements and system configuration.

Method 1: Installing Glances via DNF

The DNF package manager is Fedora’s native package management tool, making it the simplest way to install Glances. This method ensures proper integration with your system and future updates through the standard system update process.

Step 1: Update your system packages to ensure compatibility:

sudo dnf update -y

Step 2: Install Python and essential dependencies:

sudo dnf install python3 python3-pip -y

Step 3: Install the bottle module, which is required for the web interface:

sudo pip3 install bottle

Step 4: Install Glances from the Fedora repositories:

sudo dnf install glances -y

Step 5: Verify the installation was successful:

rpm -qi glances

This command displays detailed information about the installed Glances package, including version, size, installation date, and description. A successful installation indicates that Glances is ready to use on your system.

If you encounter any issues during installation, such as dependency conflicts, try resolving them with:

sudo dnf install --allowerasing glances

The primary advantage of using DNF for Glances installation is seamless integration with Fedora’s package management system, ensuring consistent updates and dependency handling.

Method 2: Installing Glances via PIP

Using Python’s package manager (pip) to install Glances offers greater flexibility and access to the latest versions. This method is particularly useful if you need specific features or want to stay current with the most recent releases.

Step 1: Ensure pip is properly installed:

sudo dnf install python3-pip -y

Step 2: Choose your installation option based on your requirements:

Basic installation (minimal features):

pip install --user glances

Web interface support:

pip install --user 'glances[web]'

Complete installation with all features:

pip install --user 'glances[all]'

The --user flag installs Glances in your user directory, avoiding potential conflicts with system packages.

Glances offers several feature flags for customized installations:

  • action: For action trigger capabilities
  • browser: For central browser functionality
  • cloud: For cloud service monitoring
  • containers: For Docker and LXC container monitoring
  • export: For data export capabilities
  • gpu: For graphics processor monitoring
  • raid: For RAID array monitoring
  • sensors: For hardware sensor readings
  • web: For web interface functionality
  • wifi: For wireless network monitoring

To upgrade Glances to the latest version when installed via pip:

pip install --user --upgrade glances

When using pip on modern Linux systems like Fedora 42, you might encounter an “externally-managed-environment” error. This is a protective measure to prevent conflicts between pip and the system package manager. If you see this error, consider using the PipX method described next.

Method 3: Installing Glances via PipX

PipX is an excellent alternative to standard pip installation, particularly for Fedora 42 users. It creates isolated environments for Python applications, eliminating conflicts with system Python packages while maintaining the simplicity of command-line tools.

Step 1: Install PipX on your Fedora system:

sudo dnf install pipx -y
sudo pipx ensurepath

Step 2: Install Glances with all features using PipX:

pipx install 'glances[all]'

For a specific subset of features, you can specify them instead of ‘all’:

pipx install 'glances[web,sensors,gpu]'

Step 3: Verify the installation and path:

which glances
glances --version

The primary advantage of PipX is its ability to maintain isolated Python environments while keeping applications accessible from the command line. This provides the best of both worlds: isolation from your system Python installation and convenient usability.

Method 4: Installing from Source

For users who want the absolute latest features and updates, installing Glances directly from the source code is an option. This method gives you access to development versions that might not yet be available through package managers.

Step 1: Install required build dependencies:

sudo dnf install git python3-devel gcc -y

Step 2: Install Glances directly from the GitHub repository:

pip install --user https://github.com/nicolargo/glances/archive/master.tar.gz

Alternatively, you can clone the repository and install from the local source:

git clone https://github.com/nicolargo/glances.git
cd glances
pip install --user .

Source installation provides the bleeding edge features but may occasionally include unstable changes. Consider this method if you need specific recent features or want to contribute to Glances development.

Installing Additional Dependencies and Plugins

Glances can be extended with various plugins to monitor specific system aspects. Each plugin may require additional dependencies.

Sensor Monitoring:

sudo dnf install lm_sensors -y
sudo sensors-detect --auto
sudo pip install --user psutil[sensors]

GPU Monitoring:

# For NVIDIA GPUs
sudo dnf install nvidia-smi -y
# For AMD GPUs
sudo dnf install rocm-smi -y
sudo pip install --user 'glances[gpu]'

Web Interface Dependencies:

sudo pip install --user 'glances[web]'

Database Export Capabilities:

# For InfluxDB support
sudo pip install --user 'glances[influxdb]'
# For Elasticsearch support
sudo pip install --user 'glances[elasticsearch]'

Container Monitoring:

sudo pip install --user 'glances[containers]'

These plugin installations enhance Glances with specialized monitoring capabilities, allowing you to customize the tool according to your specific needs.

Running Glances in Different Modes

Glances offers multiple operational modes to suit various monitoring scenarios.

Standalone Mode

The simplest way to run Glances is in standalone mode, which displays all monitoring information in your current terminal:

glances

You can adjust the refresh interval (in seconds) using the -t option:

glances -t 2

Web Server Mode

Glances can function as a web server, allowing you to monitor your system through a browser interface from any device on your network:

glances -w

Install Glances on Fedora 42

By default, the web interface runs on port 61208. Access it by navigating to:

http://your-server-ip:61208

You can specify a different port if needed:

glances -w --port 8080

Client-Server Mode

For remote monitoring, Glances supports a client-server architecture. On the server side:

glances -s

And on the client side:

glances -c serverIP

This mode is particularly useful for monitoring headless servers or remote systems.

Keyboard Shortcuts

While running Glances in interactive mode, you can use various keyboard shortcuts:

  • a: Sort processes automatically
  • c: Sort processes by CPU usage
  • m: Sort processes by memory usage
  • p: Sort processes by name
  • i: Sort processes by I/O rate
  • d: Show/hide disk I/O statistics
  • f: Show/hide file system stats
  • n: Show/hide network stats
  • s: Show/hide sensors information
  • 1: Toggle between global CPU and per-CPU statistics

These shortcuts make navigating and customizing the Glances interface quick and intuitive.

Setting Up Glances as a Service

For continuous monitoring, setting up Glances as a system service is recommended. This allows Glances to start automatically at boot and run in the background.

Step 1: Create a systemd service file:

sudo nano /etc/systemd/system/glances.service

Step 2: Add the following configuration:

[Unit]
Description=Glances Server
After=network.target

[Service]
ExecStart=/usr/bin/glances -w
Restart=on-abort
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

For InfluxDB export, modify the ExecStart line:

ExecStart=/usr/bin/glances --export influxdb

Step 3: Enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable glances.service
sudo systemctl start glances.service

Step 4: Check the service status:

sudo systemctl status glances.service

To monitor the logs from the Glances service:

sudo journalctl -u glances.service -f

This setup ensures Glances continues monitoring your system even after reboots, providing continuous performance data.

Basic Configuration

Glances configuration allows for customization of thresholds, display options, and more. The configuration file is located at ~/.config/glances/glances.conf or /etc/glances/glances.conf for system-wide settings.

To create a default configuration file:

glances --config /path/to/glances.conf

Key configuration sections include:

Threshold Settings:

[cpu]
careful=50
warning=70
critical=90

Display Options:

[display]
hide_kernel_threads=True
show_hidden_processes=False

Alert Configurations:

[alert]
cpu_critical=90
memory_critical=90

Color Scheme Adjustments:

[colors]
careful_color=blue
warning_color=violet
critical_color=red

Customizing these settings allows you to tailor Glances to your specific monitoring needs and preferences.

Using Glances for System Monitoring

Understanding how to interpret the Glances interface is essential for effective system monitoring.

The main interface is divided into sections:

  1. System Information: Shows hostname, OS, uptime, and IP addresses
  2. CPU Usage: Displays overall and per-core utilization
  3. Memory: Shows RAM and swap usage with percentage indicators
  4. Load Average: Provides 1, 5, and 15-minute load averages
  5. Network: Displays interface traffic with upload/download rates
  6. Disk I/O: Shows read/write operations per second
  7. File Systems: Displays mounted filesystems with usage percentages
  8. Processes: Lists running processes sorted by resource usage

The color-coding system helps quickly identify potential issues:

  • Green: Normal operation
  • Blue: Moderate usage (careful)
  • Violet: High usage (warning)
  • Red: Critical levels needing attention

For real-world monitoring, focus on:

  • Consistently high CPU usage (>80%)
  • Memory consumption approaching total capacity
  • Disk I/O bottlenecks
  • Network saturation
  • Processes consuming excessive resources

Regular monitoring with Glances helps establish baseline performance metrics for your system, making it easier to spot anomalies when they occur.

Advanced Features and Integrations

Glances offers numerous advanced features and integrations that extend its functionality beyond basic monitoring.

Data Export to Time-Series Databases

Glances can export data to InfluxDB for historical analysis:

glances --export influxdb

This allows creation of comprehensive dashboards using Grafana:

glances --export influxdb --export-prefix fedora42

REST API Functionality

Glances includes a REST API for integration with other tools:

glances -w --enable-api

Access API endpoints through:

http://your-server-ip:61208/api/3

Remote Monitoring Setup

For monitoring multiple systems, configure Glances servers on each:

glances -s --bind SERVERIP

Then use a central client to monitor them:

glances -c SERVERIP

Docker Container Monitoring

Monitor containers with:

glances --enable-plugin docker

This provides detailed statistics on container resource usage, state, and uptime.

Cloud Service Integration

For cloud services monitoring:

pip install --user 'glances[cloud]'
glances --enable-plugin cloud

These advanced features make Glances a versatile tool suitable for complex monitoring environments.

Troubleshooting Common Issues

When using Glances on Fedora 42, you might encounter various issues. Here are solutions to common problems:

1. Dependency Errors:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed.

Solution:

pip install --user --upgrade pip setuptools

2. Permission Problems:

error: externally-managed-environment

Solution: Use pipx instead of pip, or add the --break-system-packages flag (not recommended for production systems).

3. Web Interface Access Issues:

Unable to connect to http://your-server-ip:61208

Solution: Check firewall settings:

sudo firewall-cmd --add-port=61208/tcp --permanent
sudo firewall-cmd --reload

4. Missing Sensors Data:

N/A displayed for sensors values

Solution:

sudo dnf install lm_sensors
sudo sensors-detect --auto
sudo systemctl restart glances

5. Performance Concerns:

If Glances itself consumes excessive resources, adjust the refresh rate:

glances -t 5

For additional help, consult the Glances documentation or community forums like the GitHub issues page and Stack Overflow.

Congratulations! You have successfully installed Glances. Thanks for using this tutorial for installing the Glances monitoring tool on your Fedora 42 Linux system. For additional help or useful information, we recommend you check the official Glances website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button