Glances (7%) occupies more CPU than top (<1%), htop (2%), nmon (1%). Top occupies the lowest CPU among the three tools, which is almost negligible. It is also a tool that comes with the Linux system.
Glances provides 3 modes:
- single vision
- Client server
- Network Server
Standalone mode
If you want to monitor the local computer, open the console/terminal and just run:
$ glances
The scan should start (press "q" or "ESC" to exit):
You can also use the following command to display RAW JSON statistics directly to stdout:
$ glances --stdout cpu.user,mem.used,load
cpu.user: 30.7
mem.used: 3278204928
load: {'cpucore': 4, 'min1': 0.21, 'min5': 0.4, 'min15': 0.27}
cpu.user: 3.4
mem.used: 3275251712
load: {'cpucore': 4, 'min1': 0.19, 'min5': 0.39, 'min15': 0.27}
...
Or CSV format, thanks to the stdout-csv option:
$ glances --stdout-csv now,cpu.user,mem.used,load
now,cpu.user,mem.used,load.cpucore,load.min1,load.min5,load.min15
2018-12-08 22:04:20 CEST,7.3,5948149760,4,1.04,0.99,1.04
2018-12-08 22:04:23 CEST,5.4,5949136896,4,1.04,0.99,1.04
...
Note: Each time you refresh, each statistical information will display one row.
Client/server model
If you server
want to remotely monitor a computer named from another computer named named client
, just run on the server:
server$ glances -s
And on the client:
client$ glances -c @server
@server
Where is the IP address or host name of the server.
In server mode, you can use the setting to bind the address and use the setting to monitor the TCP port.-B ADDRESS
-p PORT
In client mode, you can set the TCP port of the server.-p PORT
The default binding address is 0.0.0.0
(Glances will listen to all available network interfaces), and the TCP port is 61209
.
In the client/server mode, the restriction is set by the server.
Central client
Glances can use the --browser
Glances server available in this option set. The [serverlist]
server list can be statically defined (partially ) through the configuration file .
Example:
[serverlist]
# Define the static servers list
server_1_name=xps
server_1_alias=xps
server_1_port=61209
server_2_name=win
server_2_port=61235
Glances can also zeroconf
detect and display all Glances servers available on the network through the protocol (not available on Windows):
To start the central client, use the following options:
client$ glances --browser
note
Use --disable-autodiscover
disable auto-discovery mode.
When the list is displayed, you can use the up/down keys to navigate between Glances servers. You can also use the following commands to sort the servers:-'1' normal (no sorting)-'2' use ascending sort (online> SNMP> protection> offline> unknown)-'3' use sort descending (UNKNOW> OFFLINE> PROTECTED) > SNMP> ONLINE)
SNMP protocol
As an experimental feature, if the client does not detect the Glances server, the client will try to use the following SNMP
protocol to obtain statistics:
client$ glances -c @snmpserver
note
The statistical information obtained by SNMP requests is limited and depends on the operating system. The SNMP server should be installed and configured...
IPv6
Glances is IPv6
compatible. Just use this option to bind to all IPv6 addresses.-B ::
Web server mode
If you want to server
remotely monitor the named machine from any device using a web browser, just run -w
the server with the following options:
server$ glances -w
Then on the client, enter the following URL in your favorite web browser:
http://@server:61208
@server
Where is the IP address or host name of the server.
To change the refresh rate of the page, simply add a time period in seconds at the end of the URL. For example, refresh the page every second 10
:
http://@server:61208/10
The Glances web interface follows the principles of responsive web design.
This is a screenshot of Chrome on Android:
How to protect your server (or web server) with login/password?
You can use to set a password to access the server --password
. By default, the login name is, glances
but you can use it to change it --username
.
If needed, the SHA password will be stored in a <login>.pwd
file (the same folder as the Glances configuration file is stored, so on the GNU Linus operating system it is ~/.config/ glances/).
The next time the server/client is run, the password will not be asked again. To set a specific user name, you can use the -u <user name> option.
You can also set the default password in the Glances configuration file:
[passwords]
# Define the passwords list
# Syntax: host=password
# Where: host is the hostname
# password is the clear password
# Additionally (and optionally) a default password could be defined
localhost=mylocalhostpassword
default=mydefaultpassword