Introduction
Glances is a cross-platform system monitoring tool written in Python. It uses the psutil library to gather system metrics and presents them in a compact, real-time terminal dashboard. It can also export data to external services or run as a web server for remote monitoring.
What Glances Does
- Displays CPU, memory, swap, disk I/O, network, and process stats in one view
- Supports client-server mode for remote system monitoring
- Runs a built-in web UI accessible from any browser
- Exports metrics to InfluxDB, Prometheus, Elasticsearch, and other backends
- Monitors Docker containers and their resource usage natively
Architecture Overview
Glances is built on top of psutil for cross-platform system metric collection. It uses a plugin-based architecture where each metric type (CPU, memory, disk, etc.) is an independent module. The curses library handles terminal rendering, while Bottle provides the optional web server. An XML-RPC or RESTful API enables client-server communication and third-party integrations.
Self-Hosting & Configuration
- Install via pip, Homebrew, or your distribution's package manager
- Run
glances -wto start the web interface on port 61208 - Configure thresholds and alerts in
~/.config/glances/glances.conf - Deploy as a Docker container with
docker run --rm -e TZ=UTC -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it nicolargo/glances - Enable export plugins by adding backend credentials to the config file
Key Features
- Single-binary-like experience with pip install and zero config needed
- Real-time curses UI with color-coded alerts based on configurable thresholds
- Built-in REST API for JSON metric access at /api/3
- Plugin system supporting custom metric collectors
- Wide export support including InfluxDB, Prometheus, MQTT, and CSV
Comparison with Similar Tools
- htop — Interactive process viewer but limited to CPU/memory; Glances shows disk, network, sensors, and containers in one screen
- btop — Polished TUI monitor with GPU support; Glances adds web mode, export backends, and client-server architecture
- Netdata — Full observability platform with dashboards; Glances is lighter and runs without a persistent agent or database
- nmon — AIX/Linux performance tool; Glances is cross-platform and has a modern Python API
FAQ
Q: Does Glances work on macOS and Windows? A: Yes. It runs on Linux, macOS, FreeBSD, and Windows via psutil's cross-platform support.
Q: Can I monitor remote machines?
A: Yes. Run glances -s on the remote host and connect with glances -c @ip. The web mode also allows browser-based remote access.
Q: How does the Docker monitoring work? A: Mount the Docker socket into the Glances container or install the docker Python package. Glances auto-detects running containers and shows per-container CPU, memory, and network stats.
Q: Can I send alerts to Slack or email? A: Glances supports export to many backends. For alerting, pipe metrics to InfluxDB or Prometheus and use Grafana or Alertmanager for notifications.