Glances is a cross-platform system monitoring tool written in Python. It uses the psutil library to get information from your system and displays it in a curses-based or web interface. It can also export metrics to external systems.
| File/Directory | Path | Purpose |
|---|---|---|
| Main config | /etc/glances/glances.conf |
Main Glances configuration |
| User config | ~/.config/glances/glances.conf |
User-specific configuration |
| Plugins | /usr/lib/python3/dist-packages/glances/plugins/ |
Plugin modules |
| Plugins config | /etc/glances/plugins.d/ |
Plugin configurations |
| Logs | /var/log/glances/ |
Log files |
| Systemd service | /etc/systemd/system/glances.service |
Service definition |
| Web assets | /usr/share/glances/static/ |
Web interface assets |
# /etc/glances/glances.conf
# ========================
# GLOBAL SETTINGS
# ========================
[global]
# Refresh rate in seconds
refresh=3
# Disable process tree
disable_process_tree=false
# Disable quick look
disable_quicklook=false
# Disable specific plugins
# Comma-separated list of plugin names
disable_plugins=
# Enable specific plugins only
enable_plugins=
# Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
log_level=INFO
# Log file path
log_file=/var/log/glances/glances.log
# Debug mode
debug=false
# Color theme (default, dark, light, blackwhite, gray)
color_theme=default
# Disable colors (for terminals that don't support colors)
disable_colors=false
# Disable bold colors
disable_bold=false
# Disable process arguments in process list
disable_process_args=false
# Show process CPU time
show_process_cpu_time=false
# Show process memory percentage
show_process_mem_percent=true
# Show I/O counters
show_io_counters=true
# Show network interfaces
show_network_interfaces=true
# Show filesystem free space
show_filesystem_free=true
# Show filesystem used space
show_filesystem_used=true
# ========================
# SERVER SETTINGS (Web/REST API)
# ========================
[server]
# Bind address
bind_address=0.0.0.0
# Port number
port=61208
# Username for authentication
username=
# Password for authentication
password=
# Enable HTTPS
https=false
# SSL certificate file
ssl_cert=
# SSL key file
ssl_key=
# URL prefix (for reverse proxy)
url_prefix=
# Enable CORS
cors=false
# Allowed origins for CORS
cors_origins=*
# Request timeout in seconds
timeout=30
# Maximum clients
max_clients=10
# Enable authentication
auth=false
# Authentication backend (htpasswd, ldap)
auth_backend=htpasswd
# htpasswd file path
htpasswd_file=/etc/glances/htpasswd
# ========================
# CLIENT SETTINGS
# ========================
[client]
# Server address
server=
# Server port
port=61208
# Username
username=
# Password=
# Browser mode (use web browser instead of curses)
browser=false
# Disable cache
disable_cache=false
# Cache lifetime in seconds
cache_lifetime=60
# ========================
# EXPORTS
# ========================
# CSV export
[csv]
# Enable CSV export
enable=false
# CSV file path
file=/var/log/glances/glances.csv
# CSV separator
separator=;
# CSV header
header=true
# InfluxDB export
[influxdb]
# Enable InfluxDB export
enable=false
# InfluxDB host
host=localhost
# InfluxDB port
port=8086
# InfluxDB database
db=glances
# InfluxDB username
user=
# InfluxDB password
password=
# InfluxDB protocol (http, https)
protocol=http
# InfluxDB prefix for metric names
prefix=
# InfluxDB tags
tags=host:myhost,datacenter:dc1
# Prometheus export
[prometheus]
# Enable Prometheus export
enable=false
# Prometheus port
port=9090
# Prometheus namespace
namespace=glances
# Prometheus labels
labels=host:myhost
# Graphite export
[graphite]
# Enable Graphite export
enable=false
# Graphite host
host=localhost
# Graphite port
port=2003
# Graphite prefix
prefix=glances
# Graphite tags
tags=host:myhost
# JSON export
[json]
# Enable JSON export
enable=false
# JSON file path
file=/var/log/glances/glances.json
# JSON indent
indent=2
# Statsd export
[statsd]
# Enable Statsd export
enable=false
# Statsd host
host=localhost
# Statsd port
port=8125
# Statsd prefix
prefix=glances
# RabbitMQ export
[rabbitmq]
# Enable RabbitMQ export
enable=false
# RabbitMQ host
host=localhost
# RabbitMQ port
port=5672
# RabbitMQ user
user=guest
# RabbitMQ password
password=guest
# RabbitMQ queue
queue=glances
# Kafka export
[kafka]
# Enable Kafka export
enable=false
# Kafka broker
broker=localhost:9092
# Kafka topic
topic=glances
# Kafka client ID
client_id=glances
# ========================
# PLUGINS
# ========================
# CPU plugin
[cpu]
# Enable CPU plugin
enable=true
# Show CPU frequency
show_cpu_frequency=true
# Show CPU percent per core
show_cpu_percent_per_core=true
# Show CPU time
show_cpu_time=false
# Show CPU context switches
show_ctx_switches=false
# Show CPU interrupts
show_interrupts=false
# Memory plugin
[memory]
# Enable memory plugin
enable=true
# Show swap
show_swap=true
# Show cache
show_cache=true
# Show buffers
show_buffers=true
# Disk I/O plugin
[diskio]
# Enable disk I/O plugin
enable=true
# Show disk I/O counters
show_diskio_counters=true
# Show disk I/O rate
show_diskio_rate=true
# Disk I/O blacklist (comma-separated)
diskio_blacklist=
# Filesystem plugin
[filesystem]
# Enable filesystem plugin
enable=true
# Show filesystem free space
show_filesystem_free=true
# Show filesystem used space
show_filesystem_used=true
# Filesystem blacklist (comma-separated)
filesystem_blacklist=tmpfs,devtmpfs,overlay,squashfs
# Filesystem show only (comma-separated mount points)
filesystem_show_only=/,/home,/var
# Show inodes
show_inodes=true
# Show filesystem I/O
show_filesystem_io=false
# Network plugin
[network]
# Enable network plugin
enable=true
# Show network bandwidth
show_network_bandwidth=true
# Show network packets
show_network_packets=false
# Show network errors
show_network_errors=false
# Network blacklist (comma-separated interface names)
network_blacklist=lo,docker,veth
# Network show only (comma-separated interface names)
network_show_only=eth0,enp0s3
# Load plugin
[load]
# Enable load plugin
enable=true
# Show load average
show_load_average=true
# Process plugin
[processlist]
# Enable process list plugin
enable=true
# Maximum processes to display
process_count=20
# Process sort key (cpu, memory, name, pid, user)
process_sort_key=cpu
# Process sort order (asc, desc)
process_sort_order=desc
# Show process CPU percent
show_process_cpu_percent=true
# Show process memory percent
show_process_memory_percent=true
# Show process memory RSS
show_process_memory_rss=false
# Show process status
show_process_status=true
# Show process nice value
show_process_nice=false
# Show process user
show_process_user=true
# Show process command
show_process_command=true
# Process blacklist (comma-separated command names)
process_blacklist=
# Sensors plugin
[sensors]
# Enable sensors plugin
enable=false
# Show temperature
show_temperature=true
# Show fan speed
show_fan_speed=false
# Show battery
show_battery=true
# Sensors blacklist (comma-separated sensor names)
sensors_blacklist=
# GPU plugin
[gpu]
# Enable GPU plugin
enable=false
# Show GPU memory
show_gpu_memory=true
# Show GPU temperature
show_gpu_temperature=false
# Show GPU utilization
show_gpu_utilization=true
# Docker plugin
[docker]
# Enable Docker plugin
enable=false
# Show Docker containers
show_docker_containers=true
# Show Docker images
show_docker_images=false
# Show Docker volumes
show_docker_volumes=false
# Show Docker networks
show_docker_networks=false
# Docker socket path
docker_socket=/var/run/docker.sock
# AMPQ plugin
[ampq]
# Enable AMPQ plugin
enable=false
# AMPQ host
host=localhost
# AMPQ port
port=5672
# AMPQ user
user=guest
# AMPQ password
password=guest
# AMPQ queue
queue=glances
# SNMP plugin
[snmp]
# Enable SNMP plugin
enable=false
# SNMP host
host=localhost
# SNMP port
port=161
# SNMP community
community=public
# SNMP version (1, 2c, 3)
version=2c
# SNMP OID
oid=
# ========================
# ALERTS
# ========================
[alerts]
# Enable alerts
enable=false
# Alert check interval in seconds
check_interval=60
# CPU alert threshold (percentage)
cpu_warning=70
cpu_critical=90
# Memory alert threshold (percentage)
memory_warning=75
memory_critical=90
# Disk alert threshold (percentage)
disk_warning=80
disk_critical=90
# Load alert threshold
load_warning=2.0
load_critical=5.0
# Alert notification method (email, slack, webhook)
notification_method=
# Email notification settings
email_smtp_host=
email_smtp_port=587
email_smtp_user=
email_smtp_password=
email_from=glances@example.com
email_to=admin@example.com
# Slack notification settings
slack_webhook_url=
slack_channel=#alerts
# Webhook notification settings
webhook_url=
webhook_method=POST
# ========================
# RESTRICTIONS
# ========================
[restrictions]
# Restrict access to specific plugins
# Comma-separated list of plugin names
disable_plugins=
# Restrict access to specific views
# Comma-separated list of view names
disable_views=
# Maximum refresh rate (seconds)
min_refresh_rate=1
# Maximum clients
max_clients=10
# ========================
# CUSTOMIZATION
# ========================
[customization]
# Custom header
header=Glances System Monitor
# Custom footer
footer=
# Show hostname
show_hostname=true
# Show IP address
show_ip=false
# Show uptime
show_uptime=true
# Show kernel version
show_kernel=false
# Show architecture
show_architecture=false
# Show OS version
show_os_version=false
# /etc/glances/plugins.d/cpu.conf
[cpu]
enable=true
show_cpu_frequency=true
show_cpu_percent_per_core=true
show_cpu_time=false
log_core_name=false
# /etc/glances/plugins.d/memory.conf
[memory]
enable=true
show_swap=true
show_cache=true
show_buffers=true
show_percent=true
# /etc/glances/plugins.d/filesystem.conf
[filesystem]
enable=true
show_filesystem_free=true
show_filesystem_used=true
show_inodes=true
filesystem_blacklist=tmpfs,devtmpfs,overlay,squashfs
filesystem_show_only=/,/home,/var,/data
# /etc/glances/plugins.d/network.conf
[network]
enable=true
show_network_bandwidth=true
show_network_packets=false
show_network_errors=false
network_blacklist=lo,docker,veth,br-
network_show_only=eth0,enp0s3,ens18
# Glances command-line options
# Basic options
glances \
--refresh 3 \
--disable-process-tree \
--disable-quicklook \
--disable-plugin diskio \
--enable-plugin cpu,memory,diskio \
--config /etc/glances/glances.conf
# Server mode
glances \
--server \
--bind-address 0.0.0.0 \
--port 61208 \
--username admin \
--password SecurePassword123! \
--https \
--ssl-cert /etc/glances/ssl/cert.pem \
--ssl-key /etc/glances/ssl/key.pem
# Client mode
glances \
--client \
--server 192.168.1.10 \
--port 61208 \
--username admin \
--password SecurePassword123!
# Web server mode
glances \
--webserver \
--bind-address 0.0.0.0 \
--port 61208 \
--username admin \
--password SecurePassword123!
# Export to InfluxDB
glances \
--export influxdb \
--export-influxdb-host localhost \
--export-influxdb-port 8086 \
--export-influxdb-db glances \
--export-influxdb-user glances \
--export-influxdb-password password
# Export to Prometheus
glances \
--export prometheus \
--export-prometheus-port 9090
# Export to CSV
glances \
--export csv \
--export-csv-file /var/log/glances/glances.csv
# Export to JSON
glances \
--export json \
--export-json-file /var/log/glances/glances.json
# Quiet mode (no output)
glances --quiet
# Debug mode
glances --debug
# Show version
glances --version
# Show help
glances --help
# /etc/systemd/system/glances.service
[Unit]
Description=Glances System Monitor
Documentation=https://glances.readthedocs.io/
After=network.target
[Service]
Type=simple
User=glances
Group=glances
# Main command
ExecStart=/usr/bin/glances \
--webserver \
--bind-address 0.0.0.0 \
--port 61208 \
--config /etc/glances/glances.conf \
--disable-plugin ampq \
--disable-plugin snmp
# Restart settings
Restart=on-failure
RestartSec=5
# Environment
Environment=GLANCES_CONF=/etc/glances/glances.conf
# Security hardening
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/log/glances /var/cache/glances
PrivateTmp=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
# Resource limits
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
# /etc/systemd/system/glances.socket
[Unit]
Description=Glances Socket
[Socket]
ListenStream=61208
Accept=false
[Install]
WantedBy=sockets.target
#!/bin/bash
# /usr/local/bin/glances-alert.sh
# Glances alert notification script
ALERT_TYPE="$1"
ALERT_VALUE="$2"
ALERT_THRESHOLD="$3"
ALERT_HOSTNAME="$4"
ALERT_TIMESTAMP="$5"
WEBHOOK_URL="https://hooks.slack.com/services/XXX/YYY/ZZZ"
# Determine color based on alert type
case "$ALERT_TYPE" in
"CRITICAL")
COLOR="danger"
EMOJI=":rotating_light:"
;;
"WARNING")
COLOR="warning"
EMOJI=":warning:"
;;
*)
COLOR="#808080"
EMOJI=":information_source:"
;;
esac
# Create payload
PAYLOAD=$(cat <<EOF
{
"attachments": [
{
"color": "$COLOR",
"title": "$EMOJI Glances Alert: $ALERT_TYPE",
"fields": [
{"title": "Host", "value": "$ALERT_HOSTNAME", "short": true},
{"title": "Metric", "value": "$ALERT_TYPE", "short": true},
{"title": "Value", "value": "$ALERT_VALUE", "short": true},
{"title": "Threshold", "value": "$ALERT_THRESHOLD", "short": true}
],
"footer": "Glances Monitoring",
"ts": $(date +%s)
}
]
}
EOF
)
curl -X POST -H 'Content-type: application/json' --data "$PAYLOAD" "$WEBHOOK_URL"
# Validate configuration syntax
glances --config /etc/glances/glances.conf --test
# Check configuration
glances --config /etc/glances/glances.conf --show-config
# Test plugins
glances --disable-plugin ampq --disable-plugin snmp --test
# Check version
glances --version
# Restart Glances service
sudo systemctl restart glances
# Check service status
sudo systemctl status glances
# View logs
sudo journalctl -u glances -f
sudo tail -f /var/log/glances/glances.log
# Reload configuration
sudo systemctl reload glances
# Start in server mode
sudo systemctl start glances-server
# Start in web server mode
sudo systemctl start glances-webserver
# Start in client mode
glances --client --server 192.168.1.10
# Start in standalone mode (curses)
glances
# Start in browser mode
glances --browser
# Check service status
sudo systemctl status glances
# Check if listening
sudo netstat -tlnp | grep 61208
# Check running processes
ps aux | grep glances
# Access web interface
curl http://localhost:61208
# Check API health
curl http://localhost:61208/api/3/health
# Get all stats
curl http://localhost:61208/api/3/all
# Get CPU stats
curl http://localhost:61208/api/3/cpu
# Get memory stats
curl http://localhost:61208/api/3/mem
# Get disk stats
curl http://localhost:61208/api/3/fs
# Get network stats
curl http://localhost:61208/api/3/network
# Test InfluxDB export
glances --export influxdb --export-influxdb-host localhost --export-influxdb-db glances --time 10
# Test Prometheus export
curl http://localhost:9090/metrics
# Test CSV export
cat /var/log/glances/glances.csv | head -20
# Test JSON export
cat /var/log/glances/glances.json | head -50
# List available plugins
glances --list-plugins
# Test specific plugin
glances --enable-plugin cpu --test
# Check plugin stats
glances --plugin cpu --show-plugin
Squeezing every bit of performance from your Glances installation? Our experts help with:
Optimize your setup: office@linux-server-admin.com | Contact Us