Developer Stacks

How to Set Up Glances Real-Time Server Monitoring Web Dashboard on Linux VPS

How to Set Up Glances Real-Time Server Monitoring Web Dashboard on Linux VPS - CpanelFree Guide
Written by Blog

Why Glances Is the Ultimate All-in-One Server Monitoring Tool

While terminal utilities like htop and full observability stacks like Prometheus/Grafana serve distinct purposes, system administrators often desire a lightweight, instant visual web dashboard that requires zero database setup and displays complete real-time hardware telemetry—CPU core loads, NVMe I/O throughput, network interface bandwidth, Docker container states, and disk file usage—directly inside any web browser.

Glances is a modern, cross-platform system monitoring tool written in Python. Featuring both a terminal UI and a responsive HTML5 web interface with REST API export capabilities, Glances enables webmasters to monitor single or multi-server infrastructure from any desktop or mobile device.

In this quick tutorial, we will configure Glances on Ubuntu 24.04/22.04 LTS, daemonize the web server via systemd, secure the dashboard with password authentication, and configure an Nginx reverse proxy with SSL encryption.

Step 1: Installing Glances via Python PIP

Install Glances and all optional hardware telemetry sensor libraries:

# Update package list and install Python 3 prerequisites
sudo apt update && sudo apt install -y python3-pip python3-venv nginx certbot python3-certbot-nginx

# Create virtual environment for Glances
sudo mkdir -p /opt/glances
cd /opt/glances
sudo python3 -m venv venv
sudo /opt/glances/venv/bin/pip install --upgrade pip
sudo /opt/glances/venv/bin/pip install "glances[all]"

Step 2: Configuring Systemd Service for Glances Web Server

Create a systemd unit at /etc/systemd/system/glances.service to supervise the web daemon:

[Unit]
Description=Glances Real-Time System Monitoring Web Server
After=network.target

[Service]
User=root
ExecStart=/opt/glances/venv/bin/glances -w -B 127.0.0.1 -p 61208 --password --username admin -P "UltraSecureGlancesPass2026!"
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

Enable and start the Glances service:

sudo systemctl daemon-reload
sudo systemctl enable --now glances
sudo systemctl status glances --no-pager

Step 3: Nginx Reverse Proxy with SSL Encryption

Create /etc/nginx/sites-available/glances.example.com:

server {
    listen 80;
    server_name glances.example.com;

    location / {
        proxy_pass http://127.0.0.1:61208;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Enable the site and issue an SSL certificate:

sudo ln -s /etc/nginx/sites-available/glances.example.com /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d glances.example.com

Exporting Telemetry Metrics to InfluxDB & Prometheus

Glances can stream hardware metrics to external time-series databases or export Prometheus endpoints automatically:

# Run Glances with Prometheus export on port 9091
/opt/glances/venv/bin/glances --export prometheus --export-prometheus-port 9091

Glances Process Management & Alert Triggers

Glances highlights system resource bottlenecks using automatic color-coded thresholds: Green (OK), Blue (Careful > 50%), Magenta (Warning > 70%), and Red (Critical > 90%). You can configure custom notification webhooks in /etc/glances/glances.conf to trigger Slack or Discord alerts whenever critical thresholds are breached.

Glances Client-Server Centralized Multi-Node Architecture

If you manage multiple Linux VPS instances, you do not need to log into each server separately. You can run Glances in client-server mode, streaming telemetry from 10 remote nodes back to a single central monitoring workstation:

# On Remote VPS Nodes: Start Glances in XML-RPC server mode
/opt/glances/venv/bin/glances -s -B 0.0.0.0 -p 61209 --password

# On Central Workstation: Connect to remote node
/opt/glances/venv/bin/glances -c 192.0.2.45 -p 61209

Glances Process Management & Hotkeys Reference

Hotkey Action / View Operational Purpose
m Sort processes by MEM% Quickly identify memory leaks in PHP/Node/Python
c Sort processes by CPU% Pinpoint runaway compute spikes
d Toggle Disk I/O Inspect read/write IOPS per disk partition

Automating Glances CSV & InfluxDB Data Export for Long-Term Trending

While Glances displays instantaneous real-time metrics, system administrators often require historical trend analysis over 30 to 90 days. Configure Glances to export system telemetry directly to CSV files or an InfluxDB time-series database:

# Stream Glances metrics to local CSV archive every 5 seconds
/opt/glances/venv/bin/glances --export csv --export-csv-file /var/log/glances_history.csv -t 5

# Stream to InfluxDB time-series database
/opt/glances/venv/bin/glances --export influxdb

Glances Advanced CLI Filtering & Headless Monitoring Modes

Glances can run in lightweight headless daemon mode without graphical interfaces, consuming less than 15MB of RAM while serving REST API metrics:

# Start headless REST API server on custom port
/opt/glances/venv/bin/glances -s -B 127.0.0.1 -p 61209

# Query real-time CPU load via curl REST endpoint
curl http://127.0.0.1:61209/api/3/cpu
# Output: {"total": 12.4, "user": 8.2, "system": 3.1, "idle": 87.6}

Glances Monitoring Architecture Checklist

  • Bind to 127.0.0.1: Never expose raw Glances ports to public interfaces without Nginx SSL and HTTP authentication.
  • Enable Docker Socket Monitoring: Grants visibility into individual container memory allocations and network I/O.

Monitor High-Performance Cloud VPS on CpanelFree

Gain complete visibility over your virtual machines with dedicated virtual CPU cores, ultra-low latency NVMe storage, and 100% free hosting options.

Get Free Cloud Hosting Today →

Glances Client-Server Architecture and Centralized Web Monitoring

In modern multi-node cloud environments, Glances provides an ultra-lightweight client-server topology that eliminates the heavy operational overhead of full-stack APM daemons. By configuring worker VPS instances in server mode and deploying a central Glances web dashboard, administrators maintain real-time cross-cluster telemetry with sub-second polling frequency:

# /etc/glances/glances.conf - Advanced Threshold Tuning
[cpu]
disable=False
user_critical=85
system_critical=80
iowait_critical=40

[network]
rx_rate_critical=100000000
tx_rate_critical=100000000

[docker]
disable=False
cpu_critical=90
mem_critical=90

Automated Alert Webhooks and Prometheus Exporter Integration

Glances supports automated threshold export to external time-series engines. Run Glances with native Prometheus exporter flags or stream system metrics to InfluxDB for long-term capacity planning:

# Run Glances with Prometheus metrics export on port 9091
glances --export prometheus --export-prometheus-port 9091 -s

# Validate Prometheus metrics endpoint
curl -s http://127.0.0.1:9091/metrics | grep glances_cpu_total

Deploying Glances behind an encrypted Nginx reverse proxy with HTTP Basic Auth or client certificates ensures real-time operational visibility without exposing critical system performance metrics to the public internet.

Deploy Fast, Reliable Web Hosting on CpanelFree

Get genuine cPanel control, unmetered NVMe SSD storage, and free AutoSSL at $0 cost forever.

Claim Free Hosting Account

About the author

Blog

DevOps architect and Linux sysadmin specializing in server hardening, OpenLiteSpeed performance optimization, and free cloud hosting infrastructure.

Leave a Comment