docker.recipes

Glances System Monitor

beginner

Glances cross-platform system monitoring tool with web interface.

Overview

Glances is a cross-platform system monitoring tool written in Python that provides real-time insights into system performance through both command-line and web interfaces. Originally created by Nicolas Hennion, Glances stands out from traditional monitoring tools by offering a comprehensive view of CPU, memory, disk I/O, network traffic, and process information in a single unified interface, with the ability to monitor both local and remote systems through various protocols. This deployment runs a single Glances container using the nicolargo/glances:latest-full image, which includes all monitoring capabilities and dependencies in one container. The configuration enables web mode through the GLANCES_OPT=-w environment variable, exposing the web interface on port 61208, and mounts the Docker socket to provide container-level monitoring alongside traditional system metrics. The container runs in host PID mode to access complete system process information and mounts system files for accurate OS detection. This setup is ideal for system administrators, DevOps teams, and homelab enthusiasts who need immediate visibility into system performance without complex multi-service deployments. The all-in-one nature makes it perfect for quick deployment scenarios, development environments, or as a lightweight monitoring solution that can export data to more comprehensive monitoring platforms like Prometheus or InfluxDB when needed.

Key Features

  • Real-time system metrics including CPU, memory, disk I/O, network, and temperature monitoring
  • Docker container monitoring through mounted Docker socket integration
  • RESTful API endpoint at /api/3 for programmatic access to all metrics
  • Built-in web interface accessible via browser with responsive design
  • Export capabilities to InfluxDB, Prometheus, CSV, and other data formats
  • Configurable alerting system with threshold-based notifications
  • Process-level monitoring with detailed per-process resource usage
  • Cross-platform compatibility with automatic OS detection and adaptation

Common Use Cases

  • 1Homelab monitoring for tracking server performance and resource utilization
  • 2Development environment monitoring to identify resource bottlenecks during testing
  • 3Lightweight server monitoring for small to medium-sized deployments
  • 4Container performance analysis and Docker resource usage tracking
  • 5System health dashboards for NOC displays or wall-mounted monitors
  • 6Data source for external monitoring systems through REST API integration
  • 7Quick system diagnostics and troubleshooting during performance issues

Prerequisites

  • Docker Engine 20.0+ with access to host system resources
  • Minimum 100MB RAM for the Glances container itself
  • Port 61208 available for web interface access
  • Docker socket access permissions for container monitoring features
  • Host PID namespace access for complete process monitoring
  • Basic understanding of system metrics interpretation and analysis

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 glances:
3 image: nicolargo/glances:latest-full
4 container_name: glances
5 environment:
6 - TZ=${TZ}
7 - GLANCES_OPT=-w
8 volumes:
9 - /var/run/docker.sock:/var/run/docker.sock:ro
10 - /etc/os-release:/etc/os-release:ro
11 ports:
12 - "61208:61208"
13 pid: host
14 restart: unless-stopped
15 networks:
16 - glances-network
17
18networks:
19 glances-network:
20 driver: bridge

.env Template

.env
1# Glances
2TZ=UTC

Usage Notes

  1. 1Web UI at http://localhost:61208
  2. 2REST API at :61208/api/3
  3. 3Docker container stats
  4. 4Export to InfluxDB, Prometheus
  5. 5Alerting support

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 glances:
5 image: nicolargo/glances:latest-full
6 container_name: glances
7 environment:
8 - TZ=${TZ}
9 - GLANCES_OPT=-w
10 volumes:
11 - /var/run/docker.sock:/var/run/docker.sock:ro
12 - /etc/os-release:/etc/os-release:ro
13 ports:
14 - "61208:61208"
15 pid: host
16 restart: unless-stopped
17 networks:
18 - glances-network
19
20networks:
21 glances-network:
22 driver: bridge
23EOF
24
25# 2. Create the .env file
26cat > .env << 'EOF'
27# Glances
28TZ=UTC
29EOF
30
31# 3. Start the services
32docker compose up -d
33
34# 4. View logs
35docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/glances-monitoring/run | bash

Troubleshooting

  • Web interface shows 'connection refused': Verify port 61208 is not blocked by firewall and container is running with GLANCES_OPT=-w
  • Docker containers not visible in monitoring: Check that /var/run/docker.sock is properly mounted and accessible by the glances container
  • Missing process information or incomplete CPU stats: Ensure container is running with pid: host configuration for full system access
  • High memory usage by Glances container: Reduce monitoring frequency or disable unused plugins through GLANCES_OPT configuration
  • API endpoints returning empty data: Verify REST API is enabled and accessible at http://localhost:61208/api/3, check container logs for errors
  • Temperature sensors not detected: Install lm-sensors on host system and ensure hardware monitoring modules are loaded

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space