This manual describes Glances version 2.2.
Copyright © 2012-2014 Nicolas Hennion <nicolas@nicolargo.com>
December 2014
Table of Contents
Glances is a cross-platform curses-based system monitoring tool which aims to present a maximum of information in a minimum of space, ideally to fit in a classical 80x24 terminal or higher to have additional information. It can adapt dynamically the displayed information depending on the terminal size.
Glances can also work in client/server mode. Remote monitoring could be done via terminal or web interface.
Glances is written in Python and uses the psutil library to get information from your system.
Console (80x24)
Full view (>80x24)
Web interface (Firefox)
If you want to remotely monitor a machine, called server, from another one, called client, just run on the server:
server$ glances -s
and on the client:
client$ glances -c @server
where @server is the IP address or hostname of the server.
Glances can centralize available Glances servers using the --browser option. The server list can be staticaly defined in the Glances configuration file (section [serverlist]). Glances can also detect and display all Glances servers available on you network (auto discover mode is based on the the Zeroconf protocol only available on GNU/Linux and Mac OS X):
client$ glances --browser
It is possible to disable the auto discover mode --disable-autodiscover.
In server mode, you can set the bind address -B ADDRESS and listening TCP port -p PORT.
In client mode, you can set the TCP port of the server -p PORT.
You can set a password to access to the server --password.
Default binding address is 0.0.0.0 (Glances will listen on all the available network interfaces) and TCP port is 61209.
In client/server mode, limits are set by the server side.
Glances is IPv6 compatible. Just use the -B :: option to bind to all IPv6 addresses.
As an experimental feature, if Glances server is not detected by the client, the latter will try to grab stats using the SNMP protocol:
client$ glances -c @snmpserver
Note: Stats grabbed by SNMP request are limited (operating system dependent).
If you want to remotely monitor a machine, called server, from any device with a web browser, just run the server with the -w option:
server$ glances -w
and on the client enter the following URL in your favorite web browser:
http://@server:61208
where @server is the IP address or hostname of the server.
The Glances web interface follows responsive web design principles.
Screenshot from Chrome on Android
-h, --help show this help message and exit -V, --version show program's version number and exit -d, --debug Enable debug mode -C CONF_FILE, --config CONF_FILE path to the configuration file --enable-history enable the history mode --disable-bold disable bold mode in the terminal --disable-diskio disable disk I/O module --disable-fs disable filesystem module --disable-network disable network module --disable-sensors disable sensors module --disable-left-sidebar disable left sidebar --disable-process disable process module --disable-log disable log module --enable-process-extended enable extended stats on top process --enable-history enable the history mode --path-history PATH_HISTORY Set the export path for graph history --output-csv OUTPUT_CSV export stats to a CSV file -c CLIENT, --client CLIENT connect to a Glances server by IPv4/IPv6 address or hostname -s, --server run Glances in server mode --browser run the Glances client browser (list of Glances server) --disable-autodiscover disable autodiscover feature -p PORT, --port PORT define the client/server TCP port [default: 61209] -B BIND_ADDRESS, --bind BIND_ADDRESS bind server to the given IPv4/IPv6 address or hostname --password-badidea PASSWORD_ARG define password from the command line --password define a client/server password from the prompt or file --disable-autodiscover Hide Glances server from the auto discover feature --snmp-community SNMP_COMMUNITY SNMP community --snmp-port SNMP_PORT SNMP port --snmp-version SNMP_VERSION SNMP version (1, 2c or 3) --snmp-user SNMP_USER SNMP username (only for SNMPv3) --snmp-auth SNMP_AUTH SNMP authentication key (only for SNMPv3) --snmp-force force SNMP mode -t TIME, --time TIME set refresh time in seconds [default: 3 sec] -w, --webserver run Glances in web server mode -f PROCESS_FILTER, --process-filter PROCESS_FILTER set the process filter patern (regular expression) --process-short-name force short name for processes name --hide-kernel-threads hide kernel threads in process list --tree display processes as a tree -b, --byte display network rate in byte per second -1, --percpu start Glances in per CPU mode --fs-free-space display FS free space instead of used --theme-white optimize display for white background
The following commands (key pressed) are supported while in Glances:
Set the process filter Filter is a regular expression pattern:
Sort process list automatically
In the Glances client browser (accessible through the --browser command line argument):
No configuration file is mandatory to use Glances.
Furthermore a configuration file is needed to set up limits, disks or network interfaces to hide and/or monitored processes list or to define alias.
By default, the configuration file is under:
Linux: | /etc/glances/glances.conf |
---|---|
*BSD and OS X: | /usr/local/etc/glances/glances.conf |
Windows: | %APPDATA%\glances\glances.conf |
On Windows XP, the %APPDATA% path is:
C:\Documents and Settings\<User>\Application Data
Since Windows Vista and newer versions:
C:\Users\<User>\AppData\Roaming or %userprofile%\AppData\Roaming
You can override the default configuration, located in one of the above directories on your system, except for Windows.
Just copy the glances.conf file to your $XDG_CONFIG_HOME directory, e.g., on Linux:
mkdir -p $XDG_CONFIG_HOME/glances
cp /usr/share/doc/glances/glances.conf $XDG_CONFIG_HOME/glances/
On OS X, you should copy the configuration file to ~/Library/Application Support/glances/.
Glances logs all its internal messages to a log file. By default, only INFO & WARNING & ERROR &CRITICAL levels are logged, but DEBUG messages can ben logged using the -d option on the command line.
By default, the log file is under:
Linux, *BSD and OS X: | |
---|---|
/tmp/glances.log | |
Windows: | %APPDATA%\Local\temp\glances.log |
Note: only stats with colored background will be logged in the alert view.
The header shows the hostname, OS name, release version, platform architecture and system uptime (on the upper right corner). Additionally, on GNU/Linux, it also shows the kernel version.
In client mode, the server connection status is displayed.
Connected:
Disconnected:
Short view:
If enough horizontal space is available, extended CPU information are displayed.
Extended view:
To switch to per-CPU stats, just hit the 1 key:
The CPU stats are shown as a percentage and for the configured refresh time. The total CPU usage is displayed on the first line.
Note: limit values can be overwritten in the configuration file under the [cpu] and/or [percpu] sections.
On the No Sheep blog, Zachary Tirrell defines the load average [1]:
"In short it is the average sum of the number of processes waiting in the run-queue plus the number currently executing over 1, 5, and 15 minutes time periods."
Glances gets the number of CPU core to adapt the alerts. Alerts on load average are only set on 15 minutes time period. The first line also displays the number of CPU core.
Note: limit values can be overwritten in the configuration file under the [load] section.
Glances uses two columns: one for the RAM and one for the SWAP.
If enough space is available, Glances displays extended information for the RAM:
Alerts are only set for used memory and used swap.
Note: limit values can be overwritten in the configuration file under the [memory] and/or [memswap] sections.
Glances displays the network interface bit rate. The unit is adapted dynamically (bits per second, kbits per second, Mbits per second, etc).
Alerts are only set if the maximum speed per network interface is available (see sample in the configuration file).
Note: it is possibile to define a list of network interfaces to hide and per-interface limit values in the [network] section of the configuration file and aliases for interface name.
Glances displays the disk I/O throughput. The unit is adapted dynamically.
There is no alert on this information.
Note: it is possible to define a list of disks to hide under the [diskio] section in the configuration file and aliases for disk name.
Glances displays the used and total file system disk space. The unit is adapted dynamically.
Alerts are set for used disk space.
Note: limit values can be overwritten in the configuration file under the [filesystem] section.
Glances can displays the sensors information using lm-sensors, hddtemp and batinfo [2].
All of the above libraries are available only on Linux.
As of lm-sensors, a filter is being applied in order to display temperature only.
There is no alert on this information.
Note: limit values and sensors alias names can be defined in the configuration file under the [sensors] section.
Compact view:
Full view:
Three views are available for processes:
The processes summary line display:
By default, or if you hit the a key, the processes list is automatically sorted by:
The number of processes in the list is adapted to the screen size.
Process status legend:
In standalone mode, additionals informations are provided for the top process:
The extended stats feature could be enabled using the --enable-process-extended option (command line) or the e key (curses interface).
Note: limit values can be overwritten in the configuration file under the [process] section.
The monitored processes list allows user, through the configuration file, to group processes and quickly show if the number of running processes is not good.
Each item is defined by:
Up to 10 items can be defined.
For example, if you want to monitor the Nginx processes on a Web server, the following definition should do the job:
[monitor] list_1_description=Nginx server list_1_regex=.*nginx.* list_1_command=nginx -v list_1_countmin=1 list_1_countmax=4
If you also want to monitor the PHP-FPM daemon processes, you should add another item:
[monitor] list_1_description=Nginx server list_1_regex=.*nginx.* list_1_command=nginx -v list_1_countmin=1 list_1_countmax=4 list_1_description=PHP-FPM list_1_regex=.*php-fpm.* list_1_countmin=1 list_1_countmax=20
In client/server mode, the list is defined on the server side. A new method, called getAllMonitored, is available in the APIs and get the JSON representation of the monitored processes list.
Alerts are set as following:
A log messages list is displayed in the bottom of the screen if (and only if):
Each alert message displays the following information:
It is possible to export statistics to CSV file.
$ glances --output-csv /tmp/glances.csv
CSV files have two lines per stats:
Glances includes a XML-RPC server and a RESTFULL-JSON API which and can be used by another client software.
APIs documentations are available at:
To post a question about Glances use case, please post it to the offical Q&A forum.
To report a bug or a feature request use the bug tracking system at https://github.com/nicolargo/glances/issues.
Feel free to contribute !
[1] | http://nosheep.net/story/defining-unix-load-average/ |
[2] | https://github.com/nicolargo/batinfo |