glances-doc.rst 25.2 KB
Newer Older
A
Alessio Sergi 已提交
1 2 3 4
=======
Glances
=======

N
nicolargo 已提交
5
This manual describes *Glances* version 2.5.1.
A
Alessio Sergi 已提交
6

N
Nicolargo 已提交
7
Copyright © 2011-2015 Nicolas Hennion <nicolas@nicolargo.com>
A
Alessio Sergi 已提交
8

N
nicolargo 已提交
9
October, 2015
A
Alessio Sergi 已提交
10 11 12 13 14 15

.. contents:: Table of Contents

Introduction
============

A
Alessio Sergi 已提交
16 17 18 19 20
Glances is a cross-platform curses-based system monitoring tool which
aims to present a maximum of information in a minimum of space, ideally
to fit in a classical 80x24 terminal or higher to have additional
information. It can adapt dynamically the displayed information depending
on the terminal size.
A
Alessio Sergi 已提交
21

A
Alessio Sergi 已提交
22 23
Glances can also work in client/server mode. Remote monitoring could be
done via terminal or web interface.
A
Alessio Sergi 已提交
24

A
Alessio Sergi 已提交
25 26
Glances is written in Python and uses the `psutil`_ library to get
information from your system.
A
Alessio Sergi 已提交
27 28 29 30 31 32 33 34 35

Console (80x24)

.. image:: images/screenshot.png

Full view (>80x24)

.. image:: images/screenshot-wide.png

N
Nicolargo 已提交
36 37 38 39
Web interface (Firefox)

.. image:: images/screenshot-web.png

A
Alessio Sergi 已提交
40 41 42
Usage
=====

A
Alessio Sergi 已提交
43
Standalone Mode
A
Alessio Sergi 已提交
44 45 46 47 48 49 50 51
---------------

Simply run:

.. code-block:: console

    $ glances

A
Alessio Sergi 已提交
52
Client/Server Mode
A
Alessio Sergi 已提交
53 54
------------------

A
Alessio Sergi 已提交
55 56
If you want to remotely monitor a machine, called ``server``, from
another one, called ``client``, just run on the server:
A
Alessio Sergi 已提交
57 58 59 60 61 62 63 64 65 66 67

.. code-block:: console

    server$ glances -s

and on the client:

.. code-block:: console

    client$ glances -c @server

A
Alessio Sergi 已提交
68
where ``@server`` is the IP address or hostname of the server.
A
Alessio Sergi 已提交
69

70 71 72 73 74 75 76
Glances can centralize available Glances servers using the ``--browser``
option. The server list can be statically defined in the Glances
configuration file (section ``[serverlist]``).

Glances can also detect and display all Glances servers available on your
network (auto-discover mode is based on the the ``zeroconf`` protocol,
which is only available on GNU/Linux and OS X):
N
Nicolargo 已提交
77 78 79

.. code-block:: console

N
Nicolargo 已提交
80 81 82
    client$ glances --browser

It is possible to disable the auto discover mode ``--disable-autodiscover``.
N
Nicolargo 已提交
83

A
Alessio Sergi 已提交
84 85
In server mode, you can set the bind address ``-B ADDRESS`` and listening
TCP port ``-p PORT``.
A
Alessio Sergi 已提交
86 87 88

In client mode, you can set the TCP port of the server ``-p PORT``.

N
Nicolargo 已提交
89
You can set a password to access to the server ``--password``.
N
Nicolargo 已提交
90

A
Alessio Sergi 已提交
91
Default binding address is ``0.0.0.0`` (Glances will listen on all the
92
available network interfaces) and TCP port is ``61209``.
A
Alessio Sergi 已提交
93 94 95

In client/server mode, limits are set by the server side.

A
Alessio Sergi 已提交
96 97
Glances is ``IPv6`` compatible. Just use the ``-B ::`` option to bind to
all IPv6 addresses.
N
Nicolas Hennion 已提交
98

A
Alessio Sergi 已提交
99 100
As an experimental feature, if Glances server is not detected by the
client, the latter will try to grab stats using the ``SNMP`` protocol:
N
Nicolargo 已提交
101 102 103

.. code-block:: console

A
Alessio Sergi 已提交
104
    client$ glances -c @snmpserver
N
Nicolargo 已提交
105

106
*Note*: stats grabbed by SNMP request are limited (OS dependent).
N
Nicolargo 已提交
107

A
Alessio Sergi 已提交
108 109
Web Server Mode
---------------
N
Nicolargo 已提交
110

A
Alessio Sergi 已提交
111
If you want to remotely monitor a machine, called ``server``, from any
N
Nicolargo 已提交
112
device with a web browser, just run the server with the ``-w`` option:
N
Nicolargo 已提交
113 114 115 116 117

.. code-block:: console

    server$ glances -w

A
Alessio Sergi 已提交
118 119 120
and on the client enter the following URL in your favorite web browser:

::
N
Nicolargo 已提交
121

A
Alessio Sergi 已提交
122
    http://@server:61208
N
Nicolargo 已提交
123 124

where ``@server`` is the IP address or hostname of the server.
N
Nicolargo 已提交
125

126 127 128 129 130 131
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 10s:

::

    http://@server:61208/10
132

A
Alessio Sergi 已提交
133 134 135
The Glances web interface follows responsive web design principles.

Screenshot from Chrome on Android
136 137

.. image:: images/screenshot-web2.png
A
Alessio Sergi 已提交
138

A
Alessio Sergi 已提交
139
Command Reference
A
Alessio Sergi 已提交
140 141
=================

A
Alessio Sergi 已提交
142
Command-Line Options
A
Alessio Sergi 已提交
143 144
--------------------

145 146
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
147
  -d, --debug           enable debug mode
148 149
  -C CONF_FILE, --config CONF_FILE
                        path to the configuration file
N
nicolargo 已提交
150 151 152 153
  -3, --disable-quicklook
                        disable quick look module
  -4, --full-quicklook
                        enable all but quick look and load
N
Nicolargo 已提交
154 155 156 157
  --disable-cpu         disable CPU module
  --disable-mem         disable MEM module
  --disable-swap        disable SWAP module
  --disable-load        disable LOAD module
158
  --disable-network     disable network module
159 160 161
  --disable-ip          disable IP module
  --disable-diskio      disable disk I/O module
  --disable-fs          disable file system module
162
  --disable-sensors     disable sensors module
163 164 165
  --disable-hddtemp     disable hddtemp module
  --disable-raid        disable RAID module
  --disable-docker      disable Docker module
N
nicolargo 已提交
166
  -2, --disable-left-sidebar
167 168
                        disable network, disk I/O, file system and
                        sensors modules (py3sensors needed)
169 170
  --disable-process     disable process module
  --disable-log         disable log module
171
  --disable-bold        disable bold mode in the terminal
172 173
  --enable-process-extended
                        enable extended stats on top process
174
  --enable-history      enable the history mode (matplotlib needed)
N
Nicolargo 已提交
175
  --path-history PATH_HISTORY
176 177
                        set the export path for graph history
  --export-csv EXPORT_CSV
178
                        export stats to a CSV file
179
  --export-influxdb     export stats to an InfluxDB server (influxdb needed)
180
  --export-opentsdb     export stats to an OpenTSDB server (potsdb needed)
181 182
  --export-statsd       export stats to a StatsD server (statsd needed)
  --export-rabbitmq     export stats to a RabbitMQ server (pika needed)
183 184 185 186
  -c CLIENT, --client CLIENT
                        connect to a Glances server by IPv4/IPv6 address or
                        hostname
  -s, --server          run Glances in server mode
187
  --browser             start the client browser (list of Glances servers)
N
Nicolargo 已提交
188 189
  --disable-autodiscover
                        disable autodiscover feature
190 191 192
  -p PORT, --port PORT  define the client/server TCP port [default: 61209]
  -B BIND_ADDRESS, --bind BIND_ADDRESS
                        bind server to the given IPv4/IPv6 address or hostname
193
  --password            define a client/server password
194 195 196 197 198 199 200 201 202 203 204 205
  --snmp-community SNMP_COMMUNITY
                        SNMP community
  --snmp-port SNMP_PORT
                        SNMP port
  --snmp-version SNMP_VERSION
                        SNMP version (1, 2c or 3)
  --snmp-user SNMP_USER
                        SNMP username (only for SNMPv3)
  --snmp-auth SNMP_AUTH
                        SNMP authentication key (only for SNMPv3)
  --snmp-force          force SNMP mode
  -t TIME, --time TIME  set refresh time in seconds [default: 3 sec]
206 207
  -w, --webserver       run Glances in web server mode (bottle needed)
  -q, --quiet           do not display the curses interface
208
  -f PROCESS_FILTER, --process-filter PROCESS_FILTER
209
                        set the process filter pattern (regular expression)
210
  --process-short-name  force short name for processes name
211
  --disable-irix        Task's cpu usage will be divided by the total number of CPUs
N
Nicolargo 已提交
212 213 214
  --hide-kernel-threads
                        hide kernel threads in process list
  --tree                display processes as a tree
215
  -b, --byte            display network rate in byte per second
N
nicolargo 已提交
216
  --fahrenheit          display temperature in Fahrenheit (default is Celsius)
217
  -1, --percpu          start Glances in per CPU mode
218
  --fs-free-space       display file system free space instead of used
219
  --theme-white         optimize display colors for white background
A
Alessio Sergi 已提交
220

A
Alessio Sergi 已提交
221
Interactive Commands
A
Alessio Sergi 已提交
222 223
--------------------

N
Nicolas Hennion 已提交
224
The following commands (key pressed) are supported while in Glances:
A
Alessio Sergi 已提交
225

N
Nicolargo 已提交
226 227
``ENTER``
    Set the process filter
228
    Note: On Mac OS, please use CTRL-H to delete filter
N
Nicolargo 已提交
229 230 231 232
    Filter is a regular expression pattern:

    - gnome: all processes starting with the gnome string
    - .*gnome.*: all processes containing the gnome string
A
Alessio Sergi 已提交
233
``a``
A
Alessio Sergi 已提交
234
    Sort process list automatically
A
Alessio Sergi 已提交
235

A
Alessio Sergi 已提交
236
    - If CPU iowait ``>60%``, sort processes by I/O read and write
A
Alessio Sergi 已提交
237 238 239
    - If CPU ``>70%``, sort processes by CPU usage
    - If MEM ``>70%``, sort processes by memory usage
``b``
A
Alessio Sergi 已提交
240
    Switch between bit/s or Byte/s for network I/O
A
Alessio Sergi 已提交
241
``c``
A
Alessio Sergi 已提交
242
    Sort processes by CPU usage
A
Alessio Sergi 已提交
243 244
``d``
    Show/hide disk I/O stats
245 246
``e``
    Enable/disable top extended stats
A
Alessio Sergi 已提交
247 248
``f``
    Show/hide file system stats
249
``F``
250
    Switch between file system used and free space
251
``g``
D
desbma 已提交
252
    Generate graphs for current history
A
Alessio Sergi 已提交
253
``h``
A
Alessio Sergi 已提交
254
    Show/hide the help screen
A
Alessio Sergi 已提交
255
``i``
A
Alessio Sergi 已提交
256
    Sort processes by I/O rate
A
Alessio Sergi 已提交
257 258 259
``l``
    Show/hide log messages
``m``
A
Alessio Sergi 已提交
260
    Sort processes by MEM usage
261 262
``M``
    Reset processes summary min/max
A
Alessio Sergi 已提交
263 264 265 266
``n``
    Show/hide network stats
``p``
    Sort processes by name
N
Nicolargo 已提交
267
``q`` or ``ESC``
D
desbma 已提交
268
    Quit the current Glances session
269 270
``r``
    Reset history
271 272
``R``
    Show/Hide RAID plugins
A
Alessio Sergi 已提交
273
``s``
N
Nicolargo 已提交
274
    Show/hide sensors stats
A
Alessio Sergi 已提交
275
``t``
276 277
    Sort process by CPU times (TIME+)
``T``
A
Alessio Sergi 已提交
278
    View network I/O as combination
A
Alessio Sergi 已提交
279
``u``
A
Alessio Sergi 已提交
280 281
    Sort processes by USER
``U``
A
Alessio Sergi 已提交
282
    View cumulative network I/O
A
Alessio Sergi 已提交
283 284 285 286
``w``
    Delete finished warning log messages
``x``
    Delete finished warning and critical log messages
M
Markus Roth 已提交
287
``z``
A
Alessio Sergi 已提交
288
    Show/hide processes stats
289 290
``0``
    Task's cpu usage will be divided by the total number of CPUs
A
Alessio Sergi 已提交
291 292
``1``
    Switch between global CPU and per-CPU stats
293 294
``2``
    Enable/disable left sidebar
N
nicolargo 已提交
295
``3``
296
    Enable/disable the quick look module
N
Nicolargo 已提交
297 298
``4``
    Enable/disable all but quick look and load module
299 300
``/``
    Switch between short name / command line (processes name)
A
Alessio Sergi 已提交
301

302 303
In the Glances client browser (accessible through the ``--browser``
command line argument):
N
Nicolargo 已提交
304 305 306 307 308 309 310 311

``ENTER``
    Run Glances client to the selected server
``UP``
    Up in the servers list
``DOWN``
    Down in the servers list
``q`` or ``ESC``
D
desbma 已提交
312
    Quit Glances
N
Nicolargo 已提交
313

A
Alessio Sergi 已提交
314 315 316
Configuration
=============

N
Nicolas Hennion 已提交
317
No configuration file is mandatory to use Glances.
A
Alessio Sergi 已提交
318

319 320 321
Furthermore a configuration file is needed to modify limit alerts, to
set up monitored processes list, to hide disks or network interfaces or
to define alias.
A
Alessio Sergi 已提交
322

323 324
Location
--------
A
Alessio Sergi 已提交
325

326 327 328 329 330 331 332
You can put the configuration file ``glances.conf`` in the following
locations:

:Linux: ``~/.config/glances, /etc/glances``
:\*BSD: ``~/.config/glances, /usr/local/etc/glances``
:OS X: ``~/Library/Application Support/glances, /usr/local/etc/glances``
:Windows: ``%APPDATA%\glances``
333 334 335

On Windows XP, the ``%APPDATA%`` path is:

A
Alessio Sergi 已提交
336
::
A
Alessio Sergi 已提交
337

338
    C:\Documents and Settings\<User>\Application Data
A
Alessio Sergi 已提交
339

340
Since Windows Vista and newer versions:
A
Alessio Sergi 已提交
341

A
Alessio Sergi 已提交
342
::
A
Alessio Sergi 已提交
343

344 345
    C:\Users\<User>\AppData\Roaming

346 347
User-specific options override system-wide options and options given on
the command line override either.
A
Alessio Sergi 已提交
348

349 350
Syntax
------
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371

Each plugin and export module can have a section.

Example for the CPU plugin:

.. code-block::

    [cpu]
    user_careful=50
    user_warning=70
    user_critical=90
    iowait_careful=50
    iowait_warning=70
    iowait_critical=90
    system_careful=50
    system_warning=70
    system_critical=90
    steal_careful=50
    steal_warning=70
    steal_critical=90

372 373
By default the ``steal`` CPU time alerts aren't logged. If you want to
enable log/alert, just add:
374 375 376 377 378

.. code-block::

    steal_log=True

379 380 381
Logs and debug mode
===================

D
desbma 已提交
382 383 384
Glances logs all its internal messages to a log file. By default, only
INFO & WARNING & ERROR &CRITICAL levels are logged, but DEBUG messages
can ben logged using the -d option on the command line.
385

D
desbma 已提交
386
By default, the log file is under:
387

388
:Linux, \*BSD, OS X: ``/tmp/glances.log``
D
desbma 已提交
389
:Windows: ``%APPDATA%\Local\temp\glances.log``
390

391 392
If ``glances.log`` is not writable, a new file will be created and
returned to the user console.
393

A
Alessio Sergi 已提交
394
Anatomy Of The Application
A
Alessio Sergi 已提交
395 396 397 398 399 400 401 402 403 404
==========================

Legend
------

| ``GREEN`` stat counter is ``"OK"``
| ``BLUE`` stat counter is ``"CAREFUL"``
| ``MAGENTA`` stat counter is ``"WARNING"``
| ``RED`` stat counter is ``"CRITICAL"``

A
Alessio Sergi 已提交
405 406
*Note*: only stats with colored background will be logged in the alert
view.
N
Nicolargo 已提交
407

A
Alessio Sergi 已提交
408 409 410 411 412
Header
------

.. image:: images/header.png

A
Alessio Sergi 已提交
413 414 415
The header shows the hostname, OS name, release version, platform
architecture and system uptime (on the upper right corner).
Additionally, on GNU/Linux, it also shows the kernel version.
N
Nicolargo 已提交
416

A
Alessio Sergi 已提交
417
In client mode, the server connection status is displayed.
N
Nicolargo 已提交
418 419 420 421 422 423

Connected:

.. image:: images/connected.png

Disconnected:
424

N
Nicolargo 已提交
425
.. image:: images/disconnected.png
A
Alessio Sergi 已提交
426

427
QuickLook
N
nicolargo 已提交
428 429
---------

430 431
The ``quicklook`` plugin is only displayed on wide screen and propose a
bar view for CPU and memory (virtual and swap).
N
nicolargo 已提交
432 433 434

.. image:: images/quicklook.png

N
nicolargo 已提交
435 436 437 438
If the per CPU mode is on (click '1'):

.. image:: images/quicklook-percpu.png

N
nicolargo 已提交
439 440 441
*Note*: limit values can be overwritten in the configuration file under
the ``[quicklook]`` section.

A
Alessio Sergi 已提交
442 443 444 445 446 447 448
CPU
---

Short view:

.. image:: images/cpu.png

A
Alessio Sergi 已提交
449 450
If enough horizontal space is available, extended CPU information are
displayed.
A
Alessio Sergi 已提交
451 452 453 454 455 456 457 458 459

Extended view:

.. image:: images/cpu-wide.png

To switch to per-CPU stats, just hit the ``1`` key:

.. image:: images/per-cpu.png

A
Alessio Sergi 已提交
460 461
The CPU stats are shown as a percentage and for the configured refresh
time. The total CPU usage is displayed on the first line.
A
Alessio Sergi 已提交
462

A
Alessio Sergi 已提交
463 464 465 466
| If user|system CPU is ``<50%``, then status is set to ``"OK"``
| If user|system CPU is ``>50%``, then status is set to ``"CAREFUL"``
| If user|system CPU is ``>70%``, then status is set to ``"WARNING"``
| If user|system CPU is ``>90%``, then status is set to ``"CRITICAL"``
A
Alessio Sergi 已提交
467

A
Alessio Sergi 已提交
468 469
*Note*: limit values can be overwritten in the configuration file under
the ``[cpu]`` and/or ``[percpu]`` sections.
N
Nicolas Hennion 已提交
470

A
Alessio Sergi 已提交
471 472 473 474 475
Load
----

.. image:: images/load.png

A
Alessio Sergi 已提交
476
On the *No Sheep* blog, *Zachary Tirrell* defines the load average [1]_:
A
Alessio Sergi 已提交
477 478 479

    "In short it is the average sum of the number of processes
    waiting in the run-queue plus the number currently executing
N
Nicolargo 已提交
480
    over 1, 5, and 15 minutes time periods."
A
Alessio Sergi 已提交
481 482

Glances gets the number of CPU core to adapt the alerts.
A
Alessio Sergi 已提交
483 484
Alerts on load average are only set on 15 minutes time period.
The first line also displays the number of CPU core.
A
Alessio Sergi 已提交
485

A
Alessio Sergi 已提交
486 487 488 489
| If load average is ``<0.7*core``, then status is set to ``"OK"``
| If load average is ``>0.7*core``, then status is set to ``"CAREFUL"``
| If load average is ``>1*core``, then status is set to ``"WARNING"``
| If load average is ``>5*core``, then status is set to ``"CRITICAL"``
A
Alessio Sergi 已提交
490

A
Alessio Sergi 已提交
491 492
*Note*: limit values can be overwritten in the configuration file under
the ``[load]`` section.
N
Nicolas Hennion 已提交
493

A
Alessio Sergi 已提交
494 495 496
Memory
------

A
Alessio Sergi 已提交
497
Glances uses two columns: one for the ``RAM`` and one for the ``SWAP``.
A
Alessio Sergi 已提交
498 499 500

.. image:: images/mem.png

A
Alessio Sergi 已提交
501 502
If enough space is available, Glances displays extended information for
the ``RAM``:
A
Alessio Sergi 已提交
503 504 505

.. image:: images/mem-wide.png

A
Alessio Sergi 已提交
506
Alerts are only set for used memory and used swap.
A
Alessio Sergi 已提交
507

A
Alessio Sergi 已提交
508 509 510 511
| If used memory|swap is ``<50%``, then status is set to ``"OK"``
| If used memory|swap is ``>50%``, then status is set to ``"CAREFUL"``
| If used memory|swap is ``>70%``, then status is set to ``"WARNING"``
| If used memory|swap is ``>90%``, then status is set to ``"CRITICAL"``
A
Alessio Sergi 已提交
512

A
Alessio Sergi 已提交
513 514
*Note*: limit values can be overwritten in the configuration file under
the ``[memory]`` and/or ``[memswap]`` sections.
N
Nicolas Hennion 已提交
515

A
Alessio Sergi 已提交
516 517 518 519 520 521 522 523
Network
-------

.. image:: images/network.png

Glances displays the network interface bit rate. The unit is adapted
dynamically (bits per second, kbits per second, Mbits per second, etc).

A
Alessio Sergi 已提交
524 525
Alerts are only set if the maximum speed per network interface is available
(see sample in the configuration file).
A
Alessio Sergi 已提交
526

A
Alessio Sergi 已提交
527 528
*Note*: it is possibile to define a list of network interfaces to hide
and per-interface limit values in the ``[network]`` section of the
D
desbma 已提交
529
configuration file and aliases for interface name.
N
Nicolas Hennion 已提交
530

A
Alessio Sergi 已提交
531 532 533 534 535 536 537
Disk I/O
--------

.. image:: images/diskio.png

Glances displays the disk I/O throughput. The unit is adapted dynamically.

A
Alessio Sergi 已提交
538
There is no alert on this information.
A
Alessio Sergi 已提交
539

A
Alessio Sergi 已提交
540
*Note*: it is possible to define a list of disks to hide under the
541
``[diskio]`` section in the configuration file and aliases for disk name.
542

A
Alessio Sergi 已提交
543
File System
A
Alessio Sergi 已提交
544 545 546 547 548 549 550
-----------

.. image:: images/fs.png

Glances displays the used and total file system disk space. The unit is
adapted dynamically.

A
Alessio Sergi 已提交
551
Alerts are set for used disk space.
A
Alessio Sergi 已提交
552

A
Alessio Sergi 已提交
553 554 555 556
| If used disk is ``<50%``, then status is set to ``"OK"``
| If used disk is ``>50%``, then status is set to ``"CAREFUL"``
| If used disk is ``>70%``, then status is set to ``"WARNING"``
| If used disk is ``>90%``, then status is set to ``"CRITICAL"``
A
Alessio Sergi 已提交
557

A
Alessio Sergi 已提交
558 559
*Note*: limit values can be overwritten in the configuration file under
the ``[filesystem]`` section.
N
Nicolas Hennion 已提交
560

N
Nicolargo 已提交
561 562 563 564
If a RAID controller is detected on you system, its status will be displayed:

.. image:: images/raid.png

565 566 567
By default, the plugin only displays physical devices (hard disks, USB
keys) and ignore all others. To allow others FS type, you have to use the
following section in the configuration file:
568 569 570 571 572 573

::

    [fs]
    allow=zfs,misc

N
Nicolargo 已提交
574 575 576
Sensors
-------

A
Alessio Sergi 已提交
577 578
Glances can displays the sensors information using `lm-sensors`,
`hddtemp` and `batinfo` [2]_.
N
Nicolargo 已提交
579

A
Alessio Sergi 已提交
580
All of the above libraries are available only on Linux.
N
Nicolargo 已提交
581

A
Alessio Sergi 已提交
582 583
As of lm-sensors, a filter is being applied in order to display
temperature only.
A
Alessio Sergi 已提交
584

A
Alessio Sergi 已提交
585
.. image:: images/sensors.png
N
Nicolargo 已提交
586 587

There is no alert on this information.
A
Alessio Sergi 已提交
588

589 590
*Note*: limit values and sensors alias names can be defined in the
configuration file under the ``[sensors]`` section.
N
Nicolas Hennion 已提交
591

A
Alessio Sergi 已提交
592
Processes List
A
Alessio Sergi 已提交
593 594 595 596 597 598 599 600 601 602
--------------

Compact view:

.. image:: images/processlist.png

Full view:

.. image:: images/processlist-wide.png

N
nicolargo 已提交
603 604 605 606
Filtered view:

.. image:: images/processlist-filter.png

N
Nicolas Hennion 已提交
607
Three views are available for processes:
A
Alessio Sergi 已提交
608 609

* Processes summary
A
Alessio Sergi 已提交
610
* Optional monitored processes list (see below)
N
Nicolas Hennion 已提交
611
* Processes list
A
Alessio Sergi 已提交
612

613 614 615
The processes summary line display:

* Tasks number (total number of processes)
A
Alessio Sergi 已提交
616
* Threads number
617 618 619
* Running tasks number
* Sleeping tasks number
* Other tasks number (not running or sleeping)
N
Nicolargo 已提交
620
* Sort key
621

A
Alessio Sergi 已提交
622 623
By default, or if you hit the ``a`` key, the processes list is
automatically sorted by:
A
Alessio Sergi 已提交
624

A
Alessio Sergi 已提交
625 626 627 628
* ``CPU`` if there is no alert (default behavior)
* ``CPU`` if a CPU or LOAD alert is detected
* ``MEM`` if a memory alert is detected
* ``Disk I/O`` if a CPU iowait alert is detected
N
Nicolas Hennion 已提交
629

A
Alessio Sergi 已提交
630 631 632 633
The number of processes in the list is adapted to the screen size.

``CPU%``
    % of CPU used by the process
634
    If IRIX mode is off (aka Solaris mode), the value is divided by logical core number
A
Alessio Sergi 已提交
635 636
``MEM%``
    % of MEM used by the process
N
Nicolargo 已提交
637
``VIRT``
638
    Total program size - Virtual Memory Size (VMS)
N
Nicolargo 已提交
639
``RES``
N
Nicolas Hennion 已提交
640
    Resident Set Size (RSS)
A
Alessio Sergi 已提交
641 642 643
``PID``
    Process ID
``USER``
N
Nicolargo 已提交
644
    User ID
A
Alessio Sergi 已提交
645
``NI``
A
Alessio Sergi 已提交
646
    Nice level of the process (niceness other than 0 is highlighted)
A
Alessio Sergi 已提交
647
``S``
A
Alessio Sergi 已提交
648
    Process status (running process is highlighted)
A
Alessio Sergi 已提交
649 650 651
``TIME+``
    Cumulative CPU time used
``IOR/s``
A
Alessio Sergi 已提交
652
    Per process I/O read rate (in Byte/s)
A
Alessio Sergi 已提交
653
``IOW/s``
A
Alessio Sergi 已提交
654
    Per process I/O write rate (in Byte/s)
N
Nicolargo 已提交
655
``COMMAND``
656
    Process command line
D
desbma 已提交
657
    User cans switch to the process name by pressing on the ``/`` key
A
Alessio Sergi 已提交
658 659 660 661

Process status legend:

``R``
N
Nicolargo 已提交
662
    Running
A
Alessio Sergi 已提交
663
``S``
N
Nicolargo 已提交
664
    Sleeping (may be interrupted)
A
Alessio Sergi 已提交
665
``D``
N
Nicolargo 已提交
666
    Disk sleep (may not be interrupted)
A
Alessio Sergi 已提交
667
``T``
N
Nicolargo 已提交
668
    Traced / Stopped
A
Alessio Sergi 已提交
669
``Z``
N
Nicolargo 已提交
670
    Zombie
A
Alessio Sergi 已提交
671

672 673
In standalone mode, additional informations are provided for the top
process:
674

N
Nicolargo 已提交
675 676
.. image:: images/processlist-top.png

677 678
* CPU affinity (number of cores used by the process)
* Extended memory information (swap, shared, text, lib, data and dirty on Linux)
679
* Open threads, files and network sessions (TCP and UDP)
D
desbma 已提交
680
* IO nice level
681

682 683
The extended stats feature could be enabled using the ``--enable-process-extended``
option (command line) or the ``e`` key (curses interface).
N
Nicolargo 已提交
684

685
*Note*: limit values can be overwritten in the configuration file under
A
Alessio Sergi 已提交
686
the ``[process]`` section.
N
Nicolas Hennion 已提交
687

A
Alessio Sergi 已提交
688
Monitored Processes List
N
Nicolas Hennion 已提交
689 690
------------------------

A
Alessio Sergi 已提交
691
The monitored processes list allows user, through the configuration file,
A
Alessio Sergi 已提交
692 693
to group processes and quickly show if the number of running processes is
not good.
N
Nicolas Hennion 已提交
694

695 696
.. image:: images/monitored.png

N
Nicolas Hennion 已提交
697 698
Each item is defined by:

A
Alessio Sergi 已提交
699 700
* ``description``: description of the processes (max 16 chars).
* ``regex``: regular expression of the processes to monitor.
A
Alessio Sergi 已提交
701 702 703 704 705 706
* ``command`` (optional): full path to shell command/script for extended
  stat. Should return a single line string. Use with caution.
* ``countmin`` (optional): minimal number of processes. A warning will
  be displayed if number of processes < count.
* ``countmax`` (optional): maximum number of processes. A warning will
  be displayed if number of processes > count.
N
Nicolas Hennion 已提交
707 708 709

Up to 10 items can be defined.

A
Alessio Sergi 已提交
710 711
For example, if you want to monitor the Nginx processes on a Web server,
the following definition should do the job:
A
Alessio Sergi 已提交
712

A
Alessio Sergi 已提交
713
::
N
Nicolas Hennion 已提交
714 715

    [monitor]
716
    list_1_description=Nginx server
N
Nicolas Hennion 已提交
717 718 719 720 721
    list_1_regex=.*nginx.*
    list_1_command=nginx -v
    list_1_countmin=1
    list_1_countmax=4

A
Alessio Sergi 已提交
722 723
If you also want to monitor the PHP-FPM daemon processes, you should add
another item:
A
Alessio Sergi 已提交
724

A
Alessio Sergi 已提交
725
::
N
Nicolas Hennion 已提交
726 727

    [monitor]
728
    list_1_description=Nginx server
N
Nicolas Hennion 已提交
729 730 731 732
    list_1_regex=.*nginx.*
    list_1_command=nginx -v
    list_1_countmin=1
    list_1_countmax=4
V
vsn4ik 已提交
733 734 735 736
    list_2_description=PHP-FPM
    list_2_regex=.*php-fpm.*
    list_2_countmin=1
    list_2_countmax=20
N
Nicolas Hennion 已提交
737

738
In client/server mode, the list is defined on the server side.
A
Alessio Sergi 已提交
739 740
A new method, called `getAllMonitored`, is available in the APIs and
get the JSON representation of the monitored processes list.
741

742
Alerts are set as following:
743 744

| If number of processes is 0, then status is set to ``"CRITICAL"``
745
| If number of processes is min < current < max, then status is set to ``"OK"``
746 747
| Else status is set to ``"WARNING"``

A
Alessio Sergi 已提交
748 749 750 751 752
Logs
----

.. image:: images/logs.png

A
Alessio Sergi 已提交
753 754
A log messages list is displayed in the bottom of the screen if (and
only if):
A
Alessio Sergi 已提交
755 756 757 758 759 760

- at least one ``WARNING`` or ``CRITICAL`` alert was occurred
- space is available in the bottom of the console/terminal

Each alert message displays the following information:

A
Alessio Sergi 已提交
761 762 763
1. start datetime
2. duration if alert is terminated or `ongoing` if the alert is still in
   progress
A
Alessio Sergi 已提交
764
3. alert name
A
Alessio Sergi 已提交
765 766
4. {min,avg,max} values or number of running processes for monitored
   processes list alerts
A
Alessio Sergi 已提交
767

N
Nicolargo 已提交
768 769 770
Docker
------

771 772
If you use ``Docker``, Glances can help you to monitor your container.
Glances uses the Docker API through the ``docker-py`` library.
N
Nicolargo 已提交
773 774 775

.. image:: images/docker.png

N
Nicolargo 已提交
776 777 778
Actions
-------

779
Glances can trigger actions on events.
N
Nicolargo 已提交
780

781 782 783
By ``action``, we mean all shell command line. For example, if you want
to execute the ``foo.py`` script if the last 5 minutes load are critical
then add the action line to the Glances configuration file:
N
Nicolargo 已提交
784

N
Nicolargo 已提交
785 786 787 788 789
.. code-block::

    [load]
    critical=5.0
    critical_action=python /path/to/foo.py
N
Nicolargo 已提交
790

791 792 793
All the stats are available in the command line through the use of the
``{{mustache}}`` syntax. Another example would be to create a log file
containing used vs total disk space if a space trigger warning is reached:
N
Nicolargo 已提交
794

N
Nicolargo 已提交
795 796 797 798 799
.. code-block::

    [fs]
    warning=70
    warning_action=echo {{mnt_point}} {{used}}/{{size}} > /tmp/fs.alert
N
Nicolargo 已提交
800

801 802 803
*Note*: you can use all the stats for the current plugin (see
https://github.com/nicolargo/glances/wiki/The-Glances-2.x-API-How-to for
the stats list)
N
Nicolargo 已提交
804

805 806 807
Gateway to others services
==========================

808 809
CSV
---
A
Alessio Sergi 已提交
810

N
Nicolargo 已提交
811
It is possible to export statistics to CSV file.
A
Alessio Sergi 已提交
812

N
Nicolas Hennion 已提交
813
.. code-block:: console
A
Alessio Sergi 已提交
814

815 816 817 818 819 820
    $ glances --export-csv /tmp/glances.csv

CSV file description:
- Stats description (first line)
- Stats (others lines)

821 822
InfluxDB
--------
A
Alessio Sergi 已提交
823

824 825 826
You can export statistics to an ``InfluxDB`` server (time series server).
The connection should be defined in the Glances configuration file as
following:
827

N
Nicolargo 已提交
828 829
.. code-block::

830 831 832 833 834 835 836 837 838 839
    [influxdb]
    host=localhost
    port=8086
    user=root
    password=root
    db=glances

and run Glances with:

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

841
    $ glances --export-influxdb
N
Nicolas Hennion 已提交
842

N
nicolargo 已提交
843 844 845
InfluxDB 0.9.x or higher also supports an optional tags
configuration parameter specified as comma separated, key:value pairs.
For example:
846 847 848 849 850 851 852 853 854 855 856 857

.. code-block::

    [influxdb]
    host=localhost
    port=8086
    user=root
    password=root
    db=glances
    tags=foo:bar,spam:eggs


858 859
For Grafana users, Glances provides a dedicated `dashboard`_. Just import
the file in your ``Grafana`` web interface.
860 861 862

.. image:: images/grafana.png

863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883
OpenTSDB
--------

You can export statistics to an ``OpenTSDB`` server (time series server).
The connection should be defined in the Glances configuration file as
following:

.. code-block::

    [opentsdb]
    host=localhost
    port=4242
    prefix=glances
    tags=foo:bar,spam:eggs

and run Glances with:

.. code-block:: console

    $ glances --export-opentsdb

884 885
Statsd
------
N
Nicolargo 已提交
886

887 888 889
You can export statistics to a ``Statsd`` server (welcome to Graphite!).
The connection should be defined in the Glances configuration file as
following:
N
Nicolargo 已提交
890

N
Nicolargo 已提交
891 892
.. code-block::

N
Nicolargo 已提交
893 894 895 896 897
    [statsd]
    host=localhost
    port=8125
    prefix=glances

898
*Note*: the prefix option is optional ('glances by default')
N
Nicolargo 已提交
899 900 901 902 903 904 905 906 907

and run Glances with:

.. code-block:: console

    $ glances --export-statsd

Glances will generate stats as:

N
Nicolargo 已提交
908 909
.. code-block::

N
Nicolargo 已提交
910 911 912 913 914 915
    'glances.cpu.user': 12.5,
    'glances.cpu.total': 14.9,
    'glances.load.cpucore': 4,
    'glances.load.min1': 0.19,
    ...

916 917
RabbitMQ
--------
918

919 920 921
You can export statistics to an ``RabbitMQ`` server (AMQP Broker).
The connection should be defined in the Glances configuration file as
following:
922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937

.. code-block::

    [rabbitmq]
    host=localhost
    port=5672
    user=glances
    password=glances
    queue=glances_queue

and run Glances with:

.. code-block:: console

    $ glances --export-rabbitmq

938 939
APIs documentation
==================
N
Nicolargo 已提交
940

941 942
Glances includes a `XML-RPC server`_ and a `RESTFUL-JSON`_ API which can
be used by another client software.
A
Alessio Sergi 已提交
943

944
APIs documentation is available at:
A
Alessio Sergi 已提交
945

946
- XML-RPC: https://github.com/nicolargo/glances/wiki/The-Glances-2.x-API-How-to
D
desbma 已提交
947
- RESTFUL-JSON: https://github.com/nicolargo/glances/wiki/The-Glances-RESTFULL-JSON-API
N
Nicolas Hennion 已提交
948

A
Alessio Sergi 已提交
949 950 951
Support
=======

952 953
To post a question about Glances use cases, please post it to the
official Q&A `forum`_.
N
Nicolargo 已提交
954

A
Alessio Sergi 已提交
955 956
To report a bug or a feature request use the bug tracking system at
https://github.com/nicolargo/glances/issues.
A
Alessio Sergi 已提交
957

N
Nicolargo 已提交
958
Feel free to contribute !
A
Alessio Sergi 已提交
959 960 961


.. [1] http://nosheep.net/story/defining-unix-load-average/
A
Alessio Sergi 已提交
962
.. [2] https://github.com/nicolargo/batinfo
A
Alessio Sergi 已提交
963 964 965

.. _psutil: https://code.google.com/p/psutil/
.. _XML-RPC server: http://docs.python.org/2/library/simplexmlrpcserver.html
D
desbma 已提交
966
.. _RESTFUL-JSON: http://jsonapi.org/
D
desbma 已提交
967
.. _forum: https://groups.google.com/forum/?hl=en#!forum/glances-users
968
.. _dashboard: https://github.com/nicolargo/glances/blob/master/conf/glances-grafana.json