glances/docs/quickstart.rst

175 lines
4.1 KiB
ReStructuredText
Raw Normal View History

2016-03-02 15:29:19 +03:00
.. _quickstart:
Quickstart
==========
This page gives a good introduction in how to get started with Glances.
Glances offers 3 modes:
- Standalone
- Client/Server
- Web server
Standalone Mode
---------------
2017-05-31 11:06:33 +03:00
If you want to monitor your local machine, open a console/terminal
and simply run:
2016-03-02 15:29:19 +03:00
.. code-block:: console
$ glances
2017-05-31 11:06:33 +03:00
Glances should start (press 'q' or 'ESC' to exit):
.. image:: _static/screenshot-wide.png
2018-02-11 13:02:16 +03:00
It is also possible to display stats directly to stdout using:
.. code-block:: console
$ 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}
...
2016-03-02 15:29:19 +03:00
Client/Server Mode
------------------
If you want to remotely monitor a machine, called ``server``, from
another one, called ``client``, just run on the server:
.. code-block:: console
server$ glances -s
and on the client:
.. code-block:: console
client$ glances -c @server
where ``@server`` is the IP address or hostname of the server.
In server mode, you can set the bind address with ``-B ADDRESS`` and
the listening TCP port with ``-p PORT``.
In client mode, you can set the TCP port of the server with ``-p PORT``.
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.
You can set a password to access to the server ``--password``. By
default, the username is ``glances`` but you can change it with
2016-08-26 15:05:40 +03:00
``--username``. It is also possible to set the password in the
Glances configuration file:
.. code-block:: ini
[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
2016-03-02 15:29:19 +03:00
If you ask it, the SHA password will be stored in ``username.pwd`` file.
2016-08-26 15:05:40 +03:00
Next time your run the server/client, password will not be asked.
2016-03-02 15:29:19 +03:00
2016-08-26 15:05:40 +03:00
Central client
^^^^^^^^^^^^^^
.. image:: _static/browser.png
2016-03-02 15:29:19 +03:00
2016-08-26 15:05:40 +03:00
Glances can centralize available Glances servers using the ``--browser``
option. The server list can be statically defined via the configuration
file (section ``[serverlist]``).
Example:
.. code-block:: ini
[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
2016-03-02 15:29:19 +03:00
Glances can also detect and display all Glances servers available on
your network via the ``zeroconf`` protocol (not available on Windows):
2016-08-26 15:05:40 +03:00
To start the central client, use the following option:
2016-03-02 15:29:19 +03:00
.. code-block:: console
client$ glances --browser
2016-08-26 15:05:40 +03:00
.. note::
2017-02-06 20:12:58 +03:00
Use ``--disable-autodiscover`` to disable the auto discovery mode.
2016-03-02 15:29:19 +03:00
SNMP
^^^^
As an experimental feature, if Glances server is not detected by the
client, the latter will try to grab stats using the ``SNMP`` protocol:
.. code-block:: console
client$ glances -c @snmpserver
.. note::
Stats grabbed by SNMP request are limited and OS dependent.
2016-08-26 15:05:40 +03:00
A SNMP server should be installed and configured...
IPv6
^^^^
Glances is ``IPv6`` compatible. Just use the ``-B ::`` option to bind to
all IPv6 addresses.
2016-03-02 15:29:19 +03:00
Web Server Mode
---------------
.. image:: _static/screenshot-web.png
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:
.. code-block:: console
server$ glances -w
then 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.
To change the refresh rate of the page, just add the period in seconds
at the end of the URL. For example, to refresh the page every ``10``
seconds:
::
http://@server:61208/10
The Glances web interface follows responsive web design principles.
Here's a screenshot from Chrome on Android:
.. image:: _static/screenshot-web2.png