README.rst 12.1 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
nicolargo 已提交
27 28 29 30 31
Follow Glances author:
.. image:: https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40nicolargo
    :target: https://twitter.com/nicolargo

Glances donation box: 
N
nicolargo 已提交
32 33 34
.. image:: https://img.shields.io/badge/Donate-PayPal-green.svg
    :target: https://www.paypal.me/nicolargo

N
nicolargo 已提交
35 36 37
Summary
=======

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

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

45 46 47
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 已提交
48 49

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

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

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

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

A
Alessio Sergi 已提交
61
Optional dependencies:
A
Alessio Sergi 已提交
62

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

90
*Note for Python 2.6 users*
N
nicolargo 已提交
91

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

*Note for CentOS Linux 6 and 7 users*

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

A
Alessio Sergi 已提交
101 102 103
Installation
============

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

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

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

.. code-block:: console

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

A
Alessio Sergi 已提交
116
or
117 118 119

.. code-block:: console

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

122 123
*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 已提交
124

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

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

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

.. code-block:: console

N
Nicolargo 已提交
135
    pip install glances
N
Nicolas Hennion 已提交
136

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

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

.. code-block:: console

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

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

.. code-block:: console

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

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

.. code-block:: console

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

N
Nicolargo 已提交
166 167 168
Docker: the funny way
---------------------

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

Get the Glances container:

.. code-block:: console

    docker pull nicolargo/glances

179
Run the container in *console mode*:
N
Nicolargo 已提交
180 181 182

.. code-block:: console

183
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it docker.io/nicolargo/glances
N
nicolargo 已提交
184

185 186
Additionally, if you want to use your own glances.conf file, you can
create your own Dockerfile:
187 188 189 190 191 192 193

.. code-block:: console

    FROM nicolargo/glances
    COPY glances.conf /glances/conf/glances.conf
    CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT

194 195
Alternatively, you can specify something along the same lines with
docker run options:
196 197 198

.. code-block:: console

199
    docker run -v `pwd`/glances.conf:/glances/conf/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -it docker.io/nicolargo/glances
200

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

203 204
Run the container in *Web server mode* (notice the `GLANCES_OPT` environment
variable setting parameters for the glances startup command):
205 206 207 208 209

.. code-block:: console

    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 docker.io/nicolargo/glances

N
Nicolargo 已提交
210 211
GNU/Linux
---------
A
Alessio Sergi 已提交
212

213 214
`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 已提交
215
when you use this method the operating system `package`_ for `Glances`
N
nicolargo 已提交
216
may not be the latest version.
A
Alessio Sergi 已提交
217

N
nicolargo 已提交
218

A
Alessio Sergi 已提交
219 220 221
FreeBSD
-------

A
Alessio Sergi 已提交
222
To install the binary package:
A
Alessio Sergi 已提交
223

A
Alessio Sergi 已提交
224 225 226 227
.. code-block:: console

    # pkg install py27-glances

A
Alessio Sergi 已提交
228 229 230
To install Glances from ports:

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

A
Alessio Sergi 已提交
232 233
    # cd /usr/ports/sysutils/py-glances/
    # make install clean
N
Nicolas Hennion 已提交
234

A
Alessio Sergi 已提交
235 236
macOS
-----
A
Alessio Sergi 已提交
237

238 239
If you do not want to use the glancesautoinstall script, follow this procedure.

A
Alessio Sergi 已提交
240
macOS users can install Glances using ``Homebrew`` or ``MacPorts``.
A
Alessio Sergi 已提交
241 242 243 244 245 246

Homebrew
````````

.. code-block:: console

N
nicolargo 已提交
247
    $ brew install glances
A
Alessio Sergi 已提交
248 249 250 251 252 253 254 255 256 257 258

MacPorts
````````

.. code-block:: console

    $ sudo port install glances

Windows
-------

259
Install `Python`_ for Windows (Python 2.7.9+ and 3.4+ ship with pip) and
C
Conor O'Callaghan 已提交
260
then run the following command:
N
Nicolargo 已提交
261 262 263 264

.. code-block:: console

    $ pip install glances
A
Alessio Sergi 已提交
265

266 267 268 269 270 271 272 273 274
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


275 276 277 278
Android
-------

You need a rooted device and the `Termux`_ application (available on the
C
Conor O'Callaghan 已提交
279
Google Play Store).
280 281 282 283 284 285 286 287

Start Termux on your device and enter:

.. code-block:: console

    $ apt update
    $ apt upgrade
    $ apt install clang python python-dev
N
nicolargo 已提交
288
    $ pip install bottle
289 290 291 292 293 294 295 296
    $ pip install glances

And start Glances:

.. code-block:: console

    $ glances

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

A
Alessio Sergi 已提交
300 301 302
Source
------

A
Alessio Sergi 已提交
303
To install Glances from source:
A
Alessio Sergi 已提交
304 305 306

.. code-block:: console

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

311
*Note*: Python headers are required to install psutil.
312

N
nicolargo 已提交
313 314 315
Chef
----

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

A
Alessio Sergi 已提交
319 320 321
Puppet
------

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

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

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

A
Alessio Sergi 已提交
329 330 331
Usage
=====

N
Nicolargo 已提交
332
For the standalone mode, just run:
A
Alessio Sergi 已提交
333 334 335

.. code-block:: console

336
    $ glances
A
Alessio Sergi 已提交
337

N
Nicolargo 已提交
338 339 340 341 342 343
For the Web server mode, run:

.. code-block:: console

    $ glances -w

A
Alessio Sergi 已提交
344
and enter the URL ``http://<ip>:61208`` in your favorite web browser.
N
Nicolargo 已提交
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359

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 已提交
360 361
You can also detect and display all Glances servers available on your
network or defined in the configuration file:
N
Nicolargo 已提交
362 363 364

.. code-block:: console

N
Nicolargo 已提交
365
    $ glances --browser
N
Nicolargo 已提交
366

367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
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 已提交
390
and RTFM, always.
N
Nicolas Hennion 已提交
391

A
Alessio Sergi 已提交
392 393 394
Documentation
=============

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

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

N
Nicolargo 已提交
399 400 401
Gateway to other services
=========================

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

N
Nicolargo 已提交
406 407 408
How to contribute ?
===================

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

A
Alessio Sergi 已提交
411
There is also a chat dedicated to the Glances developers:
N
Nicolargo 已提交
412 413 414 415

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

A
Alessio Sergi 已提交
416 417 418 419 420 421 422 423
Author
======

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

License
=======

A
Alessio Sergi 已提交
424
LGPLv3. See ``COPYING`` for more details.
A
Alessio Sergi 已提交
425

A
Alessio Sergi 已提交
426
.. _psutil: https://github.com/giampaolo/psutil
N
Nicolargo 已提交
427
.. _glancesautoinstall: https://github.com/nicolargo/glancesautoinstall
A
Alessio Sergi 已提交
428
.. _@nicolargo: https://twitter.com/nicolargo
429
.. _Python: https://www.python.org/getit/
430
.. _Termux: https://play.google.com/store/apps/details?id=com.termux
431
.. _readthedocs: https://glances.readthedocs.io/
N
Nicolargo 已提交
432
.. _forum: https://groups.google.com/forum/?hl=en#!forum/glances-users
433
.. _wiki: https://github.com/nicolargo/glances/wiki/How-to-contribute-to-Glances-%3F
N
nicolargo 已提交
434
.. _package: https://repology.org/metapackage/glances/packages