README.rst 13.0 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://pepy.tech/badge/glances/month
    :target: https://pepy.tech/project/glances
    :alt: Downloads

A
Alessio Sergi 已提交
16
.. image:: https://img.shields.io/travis/nicolargo/glances/master.svg?maxAge=3600&label=Linux%20/%20BSD%20/%20macOS
N
Nicolargo 已提交
17
    :target: https://travis-ci.org/nicolargo/glances
N
nicolargo 已提交
18 19 20 21 22 23
    :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 已提交
24 25
.. 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 已提交
26

N
Nicolas Hennion 已提交
27 28
.. image:: https://img.shields.io/badge/Donate-PayPal-green.svg
    :target: https://www.paypal.me/nicolargo
N
Nicolas Hennion 已提交
29

N
nicolargo 已提交
30 31
.. 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 已提交
32

N
nicolargo 已提交
33 34 35
Summary
=======

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

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

43 44 45
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 已提交
46 47

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

49 50 51
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 已提交
52 53 54 55

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

A
Alessio Sergi 已提交
56
- ``python 2.7,>=3.4``
A
Alessio Sergi 已提交
57
- ``psutil>=5.3.0`` (better with latest version)
A
Alessio Sergi 已提交
58

A
Alessio Sergi 已提交
59
Optional dependencies:
A
Alessio Sergi 已提交
60

N
nicolargo 已提交
61 62
- ``bernhard`` (for the Riemann export module)
- ``bottle`` (for Web server mode)
N
nicolargo 已提交
63
- ``cassandra-driver`` (for the Cassandra export module)
N
nicolargo 已提交
64
- ``couchdb`` (for the CouchDB export module)
65
- ``docker`` (for the Docker monitoring support) [Linux/macOS-only]
N
nicolargo 已提交
66 67 68
- ``elasticsearch`` (for the Elastic Search export module)
- ``hddtemp`` (for HDD temperature monitoring support) [Linux-only]
- ``influxdb`` (for the InfluxDB export module)
69
- ``kafka-python`` (for the Kafka export module)
N
nicolargo 已提交
70
- ``netifaces`` (for the IP plugin)
71
- ``nvidia-ml-py3`` (for the GPU plugin)
N
Nicolargo 已提交
72
- ``pika`` (for the RabbitMQ/ActiveMQ export module)
N
nicolargo 已提交
73
- ``potsdb`` (for the OpenTSDB export module)
74
- ``prometheus_client`` (for the Prometheus export module)
75
- ``py-cpuinfo`` (for the Quicklook CPU info module)
N
nicolargo 已提交
76
- ``pygal`` (for the graph export module)
N
nicolargo 已提交
77
- ``pymdstat`` (for RAID support) [Linux-only]
N
nicolargo 已提交
78
- ``pySMART.smartx`` (for HDD Smart support) [Linux-only]
N
nicolargo 已提交
79 80 81
- ``pysnmp`` (for SNMP support)
- ``pystache`` (for the action script feature)
- ``pyzmq`` (for the ZeroMQ export module)
A
RESTful  
Alessio Sergi 已提交
82
- ``requests`` (for the Ports, Cloud plugins and RESTful export module)
N
nicolargo 已提交
83
- ``scandir`` (for the Folders plugin) [Only for Python < 3.5]
N
nicolargo 已提交
84
- ``statsd`` (for the StatsD export module)
85
- ``wifi`` (for the wifi plugin) [Linux-only]
N
nicolargo 已提交
86
- ``zeroconf`` (for the autodiscover mode)
A
Alessio Sergi 已提交
87

88
*Note for Python 2.6 users*
N
nicolargo 已提交
89

C
Conor O'Callaghan 已提交
90
Glances no longer supports Python 2.6. Please upgrade
A
Alessio Sergi 已提交
91
to a minimum Python version of 2.7/3.4+ or downgrade to Glances 2.6.2 (last version
92 93 94 95
with Python 2.6 support).

*Note for CentOS Linux 6 and 7 users*

A
Alessio Sergi 已提交
96
Python 2.7 and 3.4 are now available via SCL repositories. See:
97
https://lists.centos.org/pipermail/centos-announce/2015-December/021555.html.
N
nicolargo 已提交
98

A
Alessio Sergi 已提交
99 100 101
Installation
============

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

Glances Auto Install script: the total way
------------------------------------------
N
Nicolargo 已提交
106

C
Conor O'Callaghan 已提交
107
To install both dependencies and the latest Glances production ready version
A
Alessio Sergi 已提交
108
(aka *master* branch), just enter the following command line:
N
Nicolargo 已提交
109 110 111

.. code-block:: console

N
Nicolargo 已提交
112
    curl -L https://bit.ly/glances | /bin/bash
N
Nicolargo 已提交
113

A
Alessio Sergi 已提交
114
or
115 116 117

.. code-block:: console

N
Nicolargo 已提交
118
    wget -O- https://bit.ly/glances | /bin/bash
119

120 121
*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`_.
N
Nicolargo 已提交
122

A
Alessio Sergi 已提交
123
PyPI: The simple way
N
Nicolas Hennion 已提交
124 125
--------------------

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

A
Alessio Sergi 已提交
129
To install, simply use ``pip``:
A
Alessio Sergi 已提交
130 131 132

.. code-block:: console

N
Nicolargo 已提交
133
    pip install glances
N
Nicolas Hennion 已提交
134

N
nicolargo 已提交
135
*Note*: Python headers are required to install `psutil`_. For example,
A
Alessio Sergi 已提交
136
on Debian/Ubuntu you need to install first the *python-dev* package.
137
For Fedora/CentOS/RHEL install first *python-devel* package. For Windows,
138
just install psutil from the binary installation file.
A
Alessio Sergi 已提交
139

N
Nicolargo 已提交
140 141 142
*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 已提交
143
You can also install the following libraries in order to use optional
144
features (like the Web interface, exports modules...):
N
Nicolargo 已提交
145 146 147

.. code-block:: console

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

N
Nicolas Hennion 已提交
150 151 152 153
To upgrade Glances to the latest version:

.. code-block:: console

N
Nicolargo 已提交
154
    pip install --upgrade glances
155
    pip install --upgrade glances[...]
N
Nicolas Hennion 已提交
156

N
Nicolargo 已提交
157 158 159 160 161
If you need to install Glances in a specific user location, use:

.. code-block:: console

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

164 165 166 167 168 169 170
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

    pip install -i https://test.pypi.org/simple/ Glances

N
Nicolargo 已提交
171 172 173
Docker: the funny way
---------------------

C
Conor O'Callaghan 已提交
174
A Glances container is available. It includes the latest development
N
nicolargo 已提交
175
HEAD version. You can use it to monitor your server and all your other
C
Conor O'Callaghan 已提交
176
containers!
N
Nicolargo 已提交
177

178
Get the Glances container (latest develop branch):
N
Nicolargo 已提交
179 180 181

.. code-block:: console

182 183 184 185 186 187 188
    docker pull nicolargo/glances:dev

Note, you can choose another branch with :

- nicolargo/glances:latest for the last master branch (included multiple architectures 386, amd64, arm/v7 and arm64)
- nicolargo/glances:dev for the last develop branch (included multiple architectures 386, amd64, arm/v7 and arm64)
- nicolargo/glances:<version> for the specific <version> (included multiple architectures 386, amd64, arm/v7 and arm64)
N
Nicolargo 已提交
189

190
Run the container in *console mode*:
N
Nicolargo 已提交
191 192 193

.. code-block:: console

194
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it nicolargo/glances:dev
N
nicolargo 已提交
195

196 197
Additionally, if you want to use your own glances.conf file, you can
create your own Dockerfile:
198 199 200

.. code-block:: console

201
    FROM nicolargo/glances:dev
202 203 204
    COPY glances.conf /glances/conf/glances.conf
    CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT

205 206
Alternatively, you can specify something along the same lines with
docker run options:
207 208 209

.. code-block:: console

210
    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:dev
211

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

214 215
Run the container in *Web server mode* (notice the `GLANCES_OPT` environment
variable setting parameters for the glances startup command):
216 217 218

.. code-block:: console

219
    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:dev
220

N
Nicolargo 已提交
221 222
GNU/Linux
---------
A
Alessio Sergi 已提交
223

224 225
`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 已提交
226
when you use this method the operating system `package`_ for `Glances`
N
nicolargo 已提交
227
may not be the latest version.
A
Alessio Sergi 已提交
228

N
nicolargo 已提交
229

A
Alessio Sergi 已提交
230 231 232
FreeBSD
-------

A
Alessio Sergi 已提交
233
To install the binary package:
A
Alessio Sergi 已提交
234

A
Alessio Sergi 已提交
235 236 237 238
.. code-block:: console

    # pkg install py27-glances

A
Alessio Sergi 已提交
239 240 241
To install Glances from ports:

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

A
Alessio Sergi 已提交
243 244
    # cd /usr/ports/sysutils/py-glances/
    # make install clean
N
Nicolas Hennion 已提交
245

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

249 250
If you do not want to use the glancesautoinstall script, follow this procedure.

A
Alessio Sergi 已提交
251
macOS users can install Glances using ``Homebrew`` or ``MacPorts``.
A
Alessio Sergi 已提交
252 253 254 255 256 257

Homebrew
````````

.. code-block:: console

N
nicolargo 已提交
258
    $ brew install glances
A
Alessio Sergi 已提交
259 260 261 262 263 264 265 266 267 268 269

MacPorts
````````

.. code-block:: console

    $ sudo port install glances

Windows
-------

270
Install `Python`_ for Windows (Python 2.7.9+ and 3.4+ ship with pip) and
C
Conor O'Callaghan 已提交
271
then run the following command:
N
Nicolargo 已提交
272 273 274 275

.. code-block:: console

    $ pip install glances
A
Alessio Sergi 已提交
276

277 278 279 280 281 282 283 284 285
Alternatively, you could clone the repository and install with the following command.

.. code-block:: console

    $ git clone https://github.com/nicolargo/glances.git
    $ cd glances
    $ python setup.py install


286 287 288 289
Android
-------

You need a rooted device and the `Termux`_ application (available on the
C
Conor O'Callaghan 已提交
290
Google Play Store).
291 292 293 294 295 296 297

Start Termux on your device and enter:

.. code-block:: console

    $ apt update
    $ apt upgrade
O
Oren Amsalem 已提交
298
    $ apt install clang python
N
nicolargo 已提交
299
    $ pip install bottle
300 301 302 303 304 305 306 307
    $ pip install glances

And start Glances:

.. code-block:: console

    $ glances

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

A
Alessio Sergi 已提交
311 312 313
Source
------

A
Alessio Sergi 已提交
314
To install Glances from source:
A
Alessio Sergi 已提交
315 316 317

.. code-block:: console

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

322
*Note*: Python headers are required to install psutil.
323

N
nicolargo 已提交
324 325 326
Chef
----

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

A
Alessio Sergi 已提交
330 331 332
Puppet
------

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

N
nicolargo 已提交
335 336 337
Ansible
-------

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

A
Alessio Sergi 已提交
340 341 342
Usage
=====

N
Nicolargo 已提交
343
For the standalone mode, just run:
A
Alessio Sergi 已提交
344 345 346

.. code-block:: console

347
    $ glances
A
Alessio Sergi 已提交
348

N
Nicolargo 已提交
349 350 351 352 353 354
For the Web server mode, run:

.. code-block:: console

    $ glances -w

A
Alessio Sergi 已提交
355
and enter the URL ``http://<ip>:61208`` in your favorite web browser.
N
Nicolargo 已提交
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370

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 已提交
371 372
You can also detect and display all Glances servers available on your
network or defined in the configuration file:
N
Nicolargo 已提交
373 374 375

.. code-block:: console

N
Nicolargo 已提交
376
    $ glances --browser
N
Nicolargo 已提交
377

378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
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 已提交
401
and RTFM, always.
N
Nicolas Hennion 已提交
402

A
Alessio Sergi 已提交
403 404 405
Documentation
=============

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

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

N
Nicolargo 已提交
410 411 412
Gateway to other services
=========================

N
nicolargo 已提交
413
Glances can export stats to: ``CSV`` file, ``JSON`` file, ``InfluxDB``, ``Cassandra``, ``CouchDB``,
414
``OpenTSDB``, ``Prometheus``, ``StatsD``, ``ElasticSearch``, ``RabbitMQ/ActiveMQ``,
A
RESTful  
Alessio Sergi 已提交
415
``ZeroMQ``, ``Kafka``, ``Riemann`` and ``RESTful`` server.
N
Nicolargo 已提交
416

N
Nicolargo 已提交
417 418 419
How to contribute ?
===================

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

A
Alessio Sergi 已提交
422
There is also a chat dedicated to the Glances developers:
N
Nicolargo 已提交
423 424 425 426

.. 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 已提交
427 428 429 430 431 432
Donation
========

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

.. image:: https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif
N
Nicolas Hennion 已提交
433
        :target: https://www.paypal.me/nicolargo
N
Nicolas Hennion 已提交
434

A
Alessio Sergi 已提交
435 436 437 438 439
Author
======

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

N
Nicolas Hennion 已提交
440 441 442
.. 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 已提交
443 444 445
License
=======

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

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