README.rst 13.5 KB
Newer Older
N
Nicolas Hennion 已提交
1 2 3 4
===============================
Glances - An eye on your system
===============================

N
Nicolargo 已提交
5 6
.. image:: https://img.shields.io/pypi/v/glances.svg
    :target: https://pypi.python.org/pypi/Glances
N
nicolargo 已提交
7

N
nicolargo 已提交
8 9 10
.. image:: https://img.shields.io/github/stars/nicolargo/glances.svg
    :target: https://github.com/nicolargo/glances/
    :alt: Github stars
N
nicolargo 已提交
11

N
nicolargo 已提交
12 13 14 15
.. image:: https://img.shields.io/docker/pulls/nicolargo/glances
    :target: https://hub.docker.com/r/nicolargo/glances/
    :alt: Docker pull

N
nicolargo 已提交
16 17
.. image:: https://pepy.tech/badge/glances/month
    :target: https://pepy.tech/project/glances
N
nicolargo 已提交
18
    :alt: Pypi downloads
N
nicolargo 已提交
19

A
Alessio Sergi 已提交
20
.. image:: https://img.shields.io/travis/nicolargo/glances/master.svg?maxAge=3600&label=Linux%20/%20BSD%20/%20macOS
N
Nicolargo 已提交
21
    :target: https://travis-ci.org/nicolargo/glances
N
nicolargo 已提交
22 23 24 25 26 27
    :alt: Linux tests (Travis)

.. image:: https://img.shields.io/appveyor/ci/nicolargo/glances/master.svg?maxAge=3600&label=Windows
    :target: https://ci.appveyor.com/project/nicolargo/glances
    :alt: Windows tests (Appveyor)

N
nicolargo 已提交
28 29
.. image:: https://scrutinizer-ci.com/g/nicolargo/glances/badges/quality-score.png?b=develop
    :target: https://scrutinizer-ci.com/g/nicolargo/glances/?branch=develop
N
Nicolargo 已提交
30

N
nicolargo 已提交
31 32
.. image:: https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/nicolargo
    :target: https://github.com/sponsors/nicolargo
N
Nicolas Hennion 已提交
33

N
nicolargo 已提交
34 35
.. image:: https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40nicolargo
    :target: https://twitter.com/nicolargo
N
nicolargo 已提交
36

N
nicolargo 已提交
37 38 39
Summary
=======

40
**Glances** is a cross-platform monitoring tool which aims to present a
C
Conor O'Callaghan 已提交
41
large amount of monitoring information through a curses or Web
N
nicolargo 已提交
42 43
based interface. The information dynamically adapts depending on the
size of the user interface.
N
nicolargo 已提交
44 45 46

.. image:: https://raw.githubusercontent.com/nicolargo/glances/develop/docs/_static/glances-summary.png

47 48 49
It can also work in client/server mode. Remote monitoring could be done
via terminal, Web interface or API (XML-RPC and RESTful). Stats can also
be exported to files or external time/value databases.
N
nicolargo 已提交
50 51

.. image:: https://raw.githubusercontent.com/nicolargo/glances/develop/docs/_static/glances-responsive-webdesign.png
A
Alessio Sergi 已提交
52

53 54 55
Glances is written in Python and uses libraries to grab information from
your system. It is based on an open architecture where developers can
add new plugins or exports modules.
A
Alessio Sergi 已提交
56 57 58 59

Requirements
============

N
nicolargo 已提交
60
- ``python>=2.7`` or ``python>=3.4``
A
Alessio Sergi 已提交
61
- ``psutil>=5.3.0`` (better with latest version)
M
Mikael Muszynski 已提交
62
- ``defusedxml`` (in order to monkey patch xmlrpc)
N
nicolargo 已提交
63
- ``future`` (for Python 2 support)
A
Alessio Sergi 已提交
64

N
nicolargo 已提交
65 66 67 68 69 70
*Note for Python 2.6 users*

Glances no longer supports Python 2.6. Please upgrade
to a minimum Python version of 2.7/3.4+ or downgrade to Glances 2.6.2 (last version
with Python 2.6 support).

N
nicolargo 已提交
71 72 73 74
*Deprecation warning note for Python 2.x users*

Glances version 4.0 will no longer supports Python 2.x.

A
Alessio Sergi 已提交
75
Optional dependencies:
A
Alessio Sergi 已提交
76

N
nicolargo 已提交
77 78
- ``bernhard`` (for the Riemann export module)
- ``bottle`` (for Web server mode)
N
nicolargo 已提交
79
- ``cassandra-driver`` (for the Cassandra export module)
80
- ``chevron`` (for the action script feature)
N
nicolargo 已提交
81
- ``couchdb`` (for the CouchDB export module)
82
- ``docker`` (for the Docker monitoring support) [Linux/macOS-only]
N
nicolargo 已提交
83
- ``elasticsearch`` (for the Elastic Search export module)
84
- ``graphitesender`` (For the Graphite export module)
N
nicolargo 已提交
85
- ``hddtemp`` (for HDD temperature monitoring support) [Linux-only]
N
nicolargo 已提交
86 87
- ``influxdb`` (for the InfluxDB version 1 export module)
- ``influxdb-client``  (for the InfluxDB version 2 export module) [Only for Python >= 3.6]
88
- ``kafka-python`` (for the Kafka export module)
N
nicolargo 已提交
89
- ``netifaces`` (for the IP plugin)
N
nicolargo 已提交
90
- ``py3nvml`` (for the GPU plugin) [Only for Python 3]
N
Nicolargo 已提交
91
- ``pika`` (for the RabbitMQ/ActiveMQ export module)
N
nicolargo 已提交
92
- ``potsdb`` (for the OpenTSDB export module)
93
- ``prometheus_client`` (for the Prometheus export module)
94
- ``py-cpuinfo`` (for the Quicklook CPU info module)
N
nicolargo 已提交
95
- ``pygal`` (for the graph export module)
N
nicolargo 已提交
96 97
- ``pymdstat`` (for RAID support) [Linux-only]
- ``pysnmp`` (for SNMP support)
N
nicolargo 已提交
98
- ``pySMART.smartx`` (for HDD Smart support) [Linux-only]
N
nicolargo 已提交
99
- ``pyzmq`` (for the ZeroMQ export module)
A
RESTful  
Alessio Sergi 已提交
100
- ``requests`` (for the Ports, Cloud plugins and RESTful export module)
N
nicolargo 已提交
101
- ``scandir`` (for the Folders plugin) [Only for Python < 3.5]
N
nicolargo 已提交
102
- ``sparklines`` (for the Quick Plugin sparklines option)
N
nicolargo 已提交
103
- ``statsd`` (for the StatsD export module)
104
- ``wifi`` (for the wifi plugin) [Linux-only]
N
nicolargo 已提交
105
- ``zeroconf`` (for the autodiscover mode)
A
Alessio Sergi 已提交
106

A
Alessio Sergi 已提交
107 108 109
Installation
============

C
Conor O'Callaghan 已提交
110
There are several methods to test/install Glances on your system. Choose your weapon!
N
Nicolargo 已提交
111

112 113
PyPI: The standard way
----------------------
N
Nicolas Hennion 已提交
114

C
Conor O'Callaghan 已提交
115
Glances is on ``PyPI``. By using PyPI, you will be using the latest
A
Alessio Sergi 已提交
116
stable version.
N
Nicolargo 已提交
117

N
nicolargo 已提交
118
To install Glances, simply use ``pip``:
A
Alessio Sergi 已提交
119 120 121

.. code-block:: console

N
nicolargo 已提交
122
    pip install --user glances
N
Nicolas Hennion 已提交
123

124 125
*Note*: Python headers are required to install `psutil`_, a Glances
dependencie. For example, on Debian/Ubuntu you need to install first
N
nicolargo 已提交
126 127
the *python-dev* package (*python-devel* on Fedora/CentOS/RHEL).
For Windows, just install psutil from the binary installation file.
A
Alessio Sergi 已提交
128

N
Nicolargo 已提交
129 130 131
*Note 2 (for the Wifi plugin)*: If you want to use the Wifi plugin, you need
to install the *wireless-tools* package on your system.

A
Alessio Sergi 已提交
132
You can also install the following libraries in order to use optional
133
features (like the Web interface, exports modules...):
N
Nicolargo 已提交
134 135 136

.. code-block:: console

N
nicolargo 已提交
137
    pip install --user 'glances[action,browser,cloud,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi]'
N
Nicolargo 已提交
138

N
Nicolas Hennion 已提交
139 140 141 142
To upgrade Glances to the latest version:

.. code-block:: console

N
nicolargo 已提交
143 144
    pip install --user --upgrade glances
    pip install --user --upgrade glances[...]
N
Nicolas Hennion 已提交
145

N
Nicolargo 已提交
146 147 148 149 150
If you need to install Glances in a specific user location, use:

.. code-block:: console

    export PYTHONUSERBASE=~/mylocalpath
N
Nicolargo 已提交
151
    pip install --user glances
N
Nicolargo 已提交
152

N
nicolargo 已提交
153 154 155 156 157 158
If you are administrator and want to install Glances for all users:

.. code-block:: console

    sudo pip install glances

159 160 161 162 163
The current develop branch is also published to the test.pypi.org package index.
If you want to test the develop version, enter:

.. code-block:: console

N
nicolargo 已提交
164 165 166
    pip install --user -i https://test.pypi.org/simple/ Glances


167 168
Glances Auto Install script: the easy way
-----------------------------------------
N
nicolargo 已提交
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184

To install both dependencies and the latest Glances production ready version
(aka *master* branch), just enter the following command line:

.. code-block:: console

    curl -L https://bit.ly/glances | /bin/bash

or

.. code-block:: console

    wget -O- https://bit.ly/glances | /bin/bash

*Note*: This is only supported on some GNU/Linux distributions and Mac OS X.
If you want to support other distributions, please contribute to `glancesautoinstall`_.
185

186 187
Docker: the fun way
-------------------
N
Nicolargo 已提交
188

189
Glances containers are availables. You can use it to monitor your
N
nicolargo 已提交
190
server and all your other containers!
N
Nicolargo 已提交
191

N
nicolargo 已提交
192
Get the Glances container:
N
Nicolargo 已提交
193 194 195

.. code-block:: console

196
    docker pull nicolargo/glances:<version>
197

198
Available versions on the Docker Hub repository:
199

200 201 202 203
- *nicolargo/glances:latest* for a basic Debian Glances image version with minimal dependencies
- *nicolargo/glances:alpine-latest* for a basic Alpine Glances image version with minimal dependencies
- *nicolargo/glances:latest-full* for a full Debian Glances image version with all dependencies
- *nicolargo/glances:alpine-latest-full* for a full Alpine Glances image version with all dependencies
N
Nicolargo 已提交
204

205 206 207
You can also specify a version by replacing latest by 3.2.3 (for example).

Run last version of Glances container in *console mode*:
N
Nicolargo 已提交
208 209 210

.. code-block:: console

211
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it nicolargo/glances:latest-full
N
nicolargo 已提交
212

213 214
Additionally, if you want to use your own glances.conf file, you can
create your own Dockerfile:
215 216 217

.. code-block:: console

N
nicolargo 已提交
218
    FROM nicolargo/glances:latest
219 220 221
    COPY glances.conf /glances/conf/glances.conf
    CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT

222 223
Alternatively, you can specify something along the same lines with
docker run options:
224 225 226

.. code-block:: console

227
    docker run -v `pwd`/glances.conf:/glances/conf/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -it nicolargo/glances:latest-full
228

229
Where \`pwd\`/glances.conf is a local directory containing your glances.conf file.
N
Nicolargo 已提交
230

231 232
Run the container in *Web server mode* (notice the `GLANCES_OPT` environment
variable setting parameters for the glances startup command):
233 234 235

.. code-block:: console

236
    docker run -d --restart="always" -p 61208-61209:61208-61209 -e GLANCES_OPT="-w" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host nicolargo/glances:latest-full
237

N
Nicolargo 已提交
238 239
GNU/Linux
---------
A
Alessio Sergi 已提交
240

241 242
`Glances` is available on many Linux distributions, so you should be
able to install it using your favorite package manager. Be aware that
N
nicolargo 已提交
243
when you use this method the operating system `package`_ for `Glances`
N
nicolargo 已提交
244
may not be the latest version.
A
Alessio Sergi 已提交
245

A
Alessio Sergi 已提交
246 247 248
FreeBSD
-------

A
Alessio Sergi 已提交
249
To install the binary package:
A
Alessio Sergi 已提交
250

A
Alessio Sergi 已提交
251 252
.. code-block:: console

S
Stefan Eßer 已提交
253
    # pkg install py37-glances
A
Alessio Sergi 已提交
254

A
Alessio Sergi 已提交
255 256 257
To install Glances from ports:

.. code-block:: console
A
Alessio Sergi 已提交
258

A
Alessio Sergi 已提交
259 260
    # cd /usr/ports/sysutils/py-glances/
    # make install clean
N
Nicolas Hennion 已提交
261

A
Alessio Sergi 已提交
262 263
macOS
-----
A
Alessio Sergi 已提交
264

265 266
If you do not want to use the glancesautoinstall script, follow this procedure.

A
Alessio Sergi 已提交
267
macOS users can install Glances using ``Homebrew`` or ``MacPorts``.
A
Alessio Sergi 已提交
268 269 270 271 272 273

Homebrew
````````

.. code-block:: console

N
nicolargo 已提交
274
    $ brew install glances
A
Alessio Sergi 已提交
275 276 277 278 279 280 281 282 283 284 285

MacPorts
````````

.. code-block:: console

    $ sudo port install glances

Windows
-------

286
Install `Python`_ for Windows (Python 2.7.9+ and 3.4+ ship with pip) and
C
Conor O'Callaghan 已提交
287
then run the following command:
N
Nicolargo 已提交
288 289 290 291

.. code-block:: console

    $ pip install glances
A
Alessio Sergi 已提交
292

293 294 295 296
Android
-------

You need a rooted device and the `Termux`_ application (available on the
C
Conor O'Callaghan 已提交
297
Google Play Store).
298 299 300 301 302 303 304

Start Termux on your device and enter:

.. code-block:: console

    $ apt update
    $ apt upgrade
O
Oren Amsalem 已提交
305
    $ apt install clang python
N
nicolargo 已提交
306
    $ pip install bottle
307 308 309 310 311 312 313 314
    $ pip install glances

And start Glances:

.. code-block:: console

    $ glances

N
nicolargo 已提交
315 316 317
You can also run Glances in server mode (-s or -w) in order to remotely
monitor your Android device.

A
Alessio Sergi 已提交
318 319 320
Source
------

A
Alessio Sergi 已提交
321
To install Glances from source:
A
Alessio Sergi 已提交
322 323 324

.. code-block:: console

325
    $ wget https://github.com/nicolargo/glances/archive/vX.Y.tar.gz -O - | tar xz
A
Alessio Sergi 已提交
326 327 328
    $ cd glances-*
    # python setup.py install

329
*Note*: Python headers are required to install psutil.
330

N
nicolargo 已提交
331 332 333
Chef
----

334 335
An awesome ``Chef`` cookbook is available to monitor your infrastructure:
https://supermarket.chef.io/cookbooks/glances (thanks to Antoine Rouyer)
N
nicolargo 已提交
336

A
Alessio Sergi 已提交
337 338 339
Puppet
------

A
Alessio Sergi 已提交
340
You can install Glances using ``Puppet``: https://github.com/rverchere/puppet-glances
A
Alessio Sergi 已提交
341

N
nicolargo 已提交
342 343 344
Ansible
-------

N
nicolargo 已提交
345
A Glances ``Ansible`` role is available: https://galaxy.ansible.com/zaxos/glances-ansible-role/
N
nicolargo 已提交
346

A
Alessio Sergi 已提交
347 348 349
Usage
=====

N
Nicolargo 已提交
350
For the standalone mode, just run:
A
Alessio Sergi 已提交
351 352 353

.. code-block:: console

354
    $ glances
A
Alessio Sergi 已提交
355

N
Nicolargo 已提交
356 357 358 359 360 361
For the Web server mode, run:

.. code-block:: console

    $ glances -w

A
Alessio Sergi 已提交
362
and enter the URL ``http://<ip>:61208`` in your favorite web browser.
N
Nicolargo 已提交
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377

For the client/server mode, run:

.. code-block:: console

    $ glances -s

on the server side and run:

.. code-block:: console

    $ glances -c <ip>

on the client one.

A
Alessio Sergi 已提交
378 379
You can also detect and display all Glances servers available on your
network or defined in the configuration file:
N
Nicolargo 已提交
380 381 382

.. code-block:: console

N
Nicolargo 已提交
383
    $ glances --browser
N
Nicolargo 已提交
384

385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
You can also display raw stats on stdout:

.. 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}
    ...

or in a CSV format thanks to the stdout-csv option:

.. code-block:: console

    $ 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
    ...

A
Alessio Sergi 已提交
408
and RTFM, always.
N
Nicolas Hennion 已提交
409

A
Alessio Sergi 已提交
410 411 412
Documentation
=============

A
Alessio Sergi 已提交
413
For complete documentation have a look at the readthedocs_ website.
A
Alessio Sergi 已提交
414

A
Alessio Sergi 已提交
415
If you have any question (after RTFM!), please post it on the official Q&A `forum`_.
N
Nicolargo 已提交
416

N
Nicolargo 已提交
417 418 419
Gateway to other services
=========================

N
nicolargo 已提交
420
Glances can export stats to: ``CSV`` file, ``JSON`` file, ``InfluxDB``, ``Cassandra``, ``CouchDB``,
421
``OpenTSDB``, ``Prometheus``, ``StatsD``, ``ElasticSearch``, ``RabbitMQ/ActiveMQ``,
N
nicolargo 已提交
422
``ZeroMQ``, ``Kafka``, ``Riemann``, ``Graphite`` and ``RESTful`` server.
N
Nicolargo 已提交
423

N
Nicolargo 已提交
424 425 426
How to contribute ?
===================

427
If you want to contribute to the Glances project, read this `wiki`_ page.
N
Nicolargo 已提交
428

A
Alessio Sergi 已提交
429
There is also a chat dedicated to the Glances developers:
N
Nicolargo 已提交
430 431 432 433

.. image:: https://badges.gitter.im/Join%20Chat.svg
        :target: https://gitter.im/nicolargo/glances?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

N
Nicolas Hennion 已提交
434 435 436 437 438
Donation
========

If this project help you, you can give me a tip ;)

N
nicolargo 已提交
439
See the sponsors_ page.
N
Nicolas Hennion 已提交
440

A
Alessio Sergi 已提交
441 442 443 444 445
Author
======

Nicolas Hennion (@nicolargo) <nicolas@nicolargo.com>

N
Nicolas Hennion 已提交
446 447 448
.. image:: https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40nicolargo
    :target: https://twitter.com/nicolargo

A
Alessio Sergi 已提交
449 450 451
License
=======

N
Nicolas Hennion 已提交
452
Glances is distributed under the LGPL version 3 license. See ``COPYING`` for more details.
A
Alessio Sergi 已提交
453

A
Alessio Sergi 已提交
454
.. _psutil: https://github.com/giampaolo/psutil
N
Nicolargo 已提交
455
.. _glancesautoinstall: https://github.com/nicolargo/glancesautoinstall
456
.. _Python: https://www.python.org/getit/
457
.. _Termux: https://play.google.com/store/apps/details?id=com.termux
458
.. _readthedocs: https://glances.readthedocs.io/
N
Nicolargo 已提交
459
.. _forum: https://groups.google.com/forum/?hl=en#!forum/glances-users
460
.. _wiki: https://github.com/nicolargo/glances/wiki/How-to-contribute-to-Glances-%3F
N
nicolargo 已提交
461
.. _package: https://repology.org/metapackage/glances/packages
N
nicolargo 已提交
462
.. _sponsors: https://github.com/sponsors/nicolargo