README.rst 10.7 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

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

20
.. image:: https://img.shields.io/scrutinizer/g/nicolargo/glances.svg
N
Nicolargo 已提交
21
    :target: https://scrutinizer-ci.com/g/nicolargo/glances/
N
Nicolargo 已提交
22

N
nicolargo 已提交
23 24 25
.. image:: https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnicolargo%2Fglances.svg?type=shield
    :target: https://app.fossa.io/projects/git%2Bgithub.com%2Fnicolargo%2Fglances?ref=badge_shield

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

Follow Glances on Twitter: `@nicolargo`_
N
Nicolargo 已提交
30

N
nicolargo 已提交
31 32 33
Summary
=======

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

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

41 42 43
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 已提交
44 45

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

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

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

54
- ``python 2.7,>=3.3``
N
nicolargo 已提交
55
- ``psutil>=2.0.0`` (better with latest version)
A
Alessio Sergi 已提交
56

A
Alessio Sergi 已提交
57
Optional dependencies:
A
Alessio Sergi 已提交
58

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

84
*Note for Python 2.6 users*
N
nicolargo 已提交
85

C
Conor O'Callaghan 已提交
86 87
Glances no longer supports Python 2.6. Please upgrade
to a minimum Python version of 2.7/3.3+ or downgrade to Glances 2.6.2 (last version
88 89 90 91
with Python 2.6 support).

*Note for CentOS Linux 6 and 7 users*

C
Conor O'Callaghan 已提交
92
Python 2.7, 3.3 and 3.4 are now available via SCL repositories. See:
93
https://lists.centos.org/pipermail/centos-announce/2015-December/021555.html.
N
nicolargo 已提交
94

A
Alessio Sergi 已提交
95 96 97
Installation
============

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

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

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

.. code-block:: console

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

A
Alessio Sergi 已提交
110
or
111 112 113

.. code-block:: console

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

C
Conor O'Callaghan 已提交
116
*Note*: This is only supported on some GNU/Linux distributions. If you want to
A
Alessio Sergi 已提交
117
support other distributions, please contribute to `glancesautoinstall`_.
N
Nicolargo 已提交
118

A
Alessio Sergi 已提交
119
PyPI: The simple way
N
Nicolas Hennion 已提交
120 121
--------------------

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

A
Alessio Sergi 已提交
125
To install, simply use ``pip``:
A
Alessio Sergi 已提交
126 127 128

.. code-block:: console

N
Nicolargo 已提交
129
    pip install glances
N
Nicolas Hennion 已提交
130

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

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

.. code-block:: console

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

N
Nicolas Hennion 已提交
146 147 148 149
To upgrade Glances to the latest version:

.. code-block:: console

N
Nicolargo 已提交
150
    pip install --upgrade glances
151
    pip install --upgrade glances[...]
N
Nicolas Hennion 已提交
152

N
Nicolargo 已提交
153 154 155 156 157
If you need to install Glances in a specific user location, use:

.. code-block:: console

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

N
Nicolargo 已提交
160 161 162
Docker: the funny way
---------------------

C
Conor O'Callaghan 已提交
163
A Glances container is available. It includes the latest development
N
nicolargo 已提交
164
HEAD version. You can use it to monitor your server and all your other
C
Conor O'Callaghan 已提交
165
containers!
N
Nicolargo 已提交
166 167 168 169 170 171 172

Get the Glances container:

.. code-block:: console

    docker pull nicolargo/glances

173
Run the container in *console mode*:
N
Nicolargo 已提交
174 175 176 177

.. code-block:: console

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

179 180
Additionally, if you want to use your own glances.conf file, you can
create your own Dockerfile:
181 182 183 184 185 186 187

.. code-block:: console

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

188 189
Alternatively, you can specify something along the same lines with
docker run options:
190 191 192 193 194 195

.. code-block:: console

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

Where ./glances.conf is a local directory containing your glances.conf file.
N
Nicolargo 已提交
196

197 198
Run the container in *Web server mode* (notice the `GLANCES_OPT` environment
variable setting parameters for the glances startup command):
199 200 201 202 203

.. 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 已提交
204 205
GNU/Linux
---------
A
Alessio Sergi 已提交
206

207 208
`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 已提交
209 210
when you use this method the operating system package for `Glances`
may not be the latest version.
A
Alessio Sergi 已提交
211

A
Alessio Sergi 已提交
212 213 214
FreeBSD
-------

A
Alessio Sergi 已提交
215
To install the binary package:
A
Alessio Sergi 已提交
216

A
Alessio Sergi 已提交
217 218 219 220
.. code-block:: console

    # pkg install py27-glances

A
Alessio Sergi 已提交
221 222 223
To install Glances from ports:

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

A
Alessio Sergi 已提交
225 226
    # cd /usr/ports/sysutils/py-glances/
    # make install clean
N
Nicolas Hennion 已提交
227

A
Alessio Sergi 已提交
228 229
macOS
-----
A
Alessio Sergi 已提交
230

A
Alessio Sergi 已提交
231
macOS users can install Glances using ``Homebrew`` or ``MacPorts``.
A
Alessio Sergi 已提交
232 233 234 235 236 237

Homebrew
````````

.. code-block:: console

238
    $ brew install python
N
Nicolargo 已提交
239
    $ pip install glances
A
Alessio Sergi 已提交
240 241 242 243 244 245 246 247 248 249 250

MacPorts
````````

.. code-block:: console

    $ sudo port install glances

Windows
-------

251
Install `Python`_ for Windows (Python 2.7.9+ and 3.4+ ship with pip) and
C
Conor O'Callaghan 已提交
252
then run the following command:
N
Nicolargo 已提交
253 254 255 256

.. code-block:: console

    $ pip install glances
A
Alessio Sergi 已提交
257

258 259 260 261
Android
-------

You need a rooted device and the `Termux`_ application (available on the
C
Conor O'Callaghan 已提交
262
Google Play Store).
263 264 265 266 267 268 269 270

Start Termux on your device and enter:

.. code-block:: console

    $ apt update
    $ apt upgrade
    $ apt install clang python python-dev
N
nicolargo 已提交
271
    $ pip install bottle
272 273 274 275 276 277 278 279
    $ pip install glances

And start Glances:

.. code-block:: console

    $ glances

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

A
Alessio Sergi 已提交
283 284 285
Source
------

A
Alessio Sergi 已提交
286
To install Glances from source:
A
Alessio Sergi 已提交
287 288 289

.. code-block:: console

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

294
*Note*: Python headers are required to install psutil.
295

N
nicolargo 已提交
296 297 298
Chef
----

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

A
Alessio Sergi 已提交
302 303 304
Puppet
------

A
Alessio Sergi 已提交
305
You can install Glances using ``Puppet``: https://github.com/rverchere/puppet-glances
A
Alessio Sergi 已提交
306 307 308 309

Usage
=====

N
Nicolargo 已提交
310
For the standalone mode, just run:
A
Alessio Sergi 已提交
311 312 313

.. code-block:: console

314
    $ glances
A
Alessio Sergi 已提交
315

N
Nicolargo 已提交
316 317 318 319 320 321
For the Web server mode, run:

.. code-block:: console

    $ glances -w

A
Alessio Sergi 已提交
322
and enter the URL ``http://<ip>:61208`` in your favorite web browser.
N
Nicolargo 已提交
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337

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 已提交
338 339
You can also detect and display all Glances servers available on your
network or defined in the configuration file:
N
Nicolargo 已提交
340 341 342

.. code-block:: console

N
Nicolargo 已提交
343
    $ glances --browser
N
Nicolargo 已提交
344

A
Alessio Sergi 已提交
345
and RTFM, always.
N
Nicolas Hennion 已提交
346

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

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

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

N
Nicolargo 已提交
354 355 356
Gateway to other services
=========================

N
nicolargo 已提交
357
Glances can export stats to: ``CSV`` file, ``JSON`` file, ``InfluxDB``, ``Cassandra``, ``CouchDB``,
358
``OpenTSDB``, ``Prometheus``, ``StatsD``, ``ElasticSearch``, ``RabbitMQ/ActiveMQ``,
359
``ZeroMQ``, ``Kafka``, ``Riemann`` and ``Restful`` server.
N
Nicolargo 已提交
360

N
Nicolargo 已提交
361 362 363
How to contribute ?
===================

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

A
Alessio Sergi 已提交
366
There is also a chat dedicated to the Glances developers:
N
Nicolargo 已提交
367 368 369 370

.. 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 已提交
371 372 373 374 375 376 377 378
Author
======

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

License
=======

A
Alessio Sergi 已提交
379
LGPLv3. See ``COPYING`` for more details.
A
Alessio Sergi 已提交
380

A
Alessio Sergi 已提交
381
.. _psutil: https://github.com/giampaolo/psutil
N
Nicolargo 已提交
382
.. _glancesautoinstall: https://github.com/nicolargo/glancesautoinstall
A
Alessio Sergi 已提交
383
.. _@nicolargo: https://twitter.com/nicolargo
384
.. _Python: https://www.python.org/getit/
385
.. _Termux: https://play.google.com/store/apps/details?id=com.termux
386
.. _readthedocs: https://glances.readthedocs.io/
N
Nicolargo 已提交
387
.. _forum: https://groups.google.com/forum/?hl=en#!forum/glances-users
388
.. _wiki: https://github.com/nicolargo/glances/wiki/How-to-contribute-to-Glances-%3F