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

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

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

N
Nicolargo 已提交
9
January 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

N
Nicolargo 已提交
70
Glances can centralize available Glances servers using the ``--browser`` option. The server list can be staticaly defined in the Glances configuration file (section [serverlist]). Glances can also detect and display all Glances servers available on you network (auto discover mode is based on the the Zeroconf protocol only available on GNU/Linux and Mac OS X):
N
Nicolargo 已提交
71 72 73

.. code-block:: console

N
Nicolargo 已提交
74 75 76
    client$ glances --browser

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

A
Alessio Sergi 已提交
78 79
In server mode, you can set the bind address ``-B ADDRESS`` and listening
TCP port ``-p PORT``.
A
Alessio Sergi 已提交
80 81 82

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

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

A
Alessio Sergi 已提交
85
Default binding address is ``0.0.0.0`` (Glances will listen on all the
86
available network interfaces) and TCP port is ``61209``.
A
Alessio Sergi 已提交
87 88 89

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

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

A
Alessio Sergi 已提交
93 94
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 已提交
95 96 97

.. code-block:: console

A
Alessio Sergi 已提交
98
    client$ glances -c @snmpserver
N
Nicolargo 已提交
99

N
Nicolargo 已提交
100
Note: Stats grabbed by SNMP request are limited (operating system dependent).
N
Nicolargo 已提交
101

A
Alessio Sergi 已提交
102 103
Web Server Mode
---------------
N
Nicolargo 已提交
104

A
Alessio Sergi 已提交
105
If you want to remotely monitor a machine, called ``server``, from any
N
Nicolargo 已提交
106
device with a web browser, just run the server with the ``-w`` option:
N
Nicolargo 已提交
107 108 109 110 111

.. code-block:: console

    server$ glances -w

A
Alessio Sergi 已提交
112 113 114
and on the client enter the following URL in your favorite web browser:

::
N
Nicolargo 已提交
115

A
Alessio Sergi 已提交
116
    http://@server:61208
N
Nicolargo 已提交
117 118

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

120 121
To change the refresh rate of the page, just add the period in seconds between refreshes at the end of the URL, ie. to refresh every 10s, use ``http://@server:61208/10``.

A
Alessio Sergi 已提交
122 123 124
The Glances web interface follows responsive web design principles.

Screenshot from Chrome on Android
125 126

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

N
Nicolas Hennion 已提交
128

A
Alessio Sergi 已提交
129
Command Reference
A
Alessio Sergi 已提交
130 131
=================

A
Alessio Sergi 已提交
132
Command-Line Options
A
Alessio Sergi 已提交
133 134
--------------------

135 136 137 138 139 140 141 142 143 144 145
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -d, --debug           Enable debug mode
  -C CONF_FILE, --config CONF_FILE
                        path to the configuration file
  --enable-history      enable the history mode
  --disable-bold        disable bold mode in the terminal
  --disable-diskio      disable disk I/O module
  --disable-fs          disable filesystem module
  --disable-network     disable network module
  --disable-sensors     disable sensors module
146 147
  --disable-left-sidebar
                        disable left sidebar
148 149
  --disable-process     disable process module
  --disable-log         disable log module
150 151
  --enable-process-extended
                        enable extended stats on top process
N
Nicolargo 已提交
152 153 154
  --enable-history      enable the history mode
  --path-history PATH_HISTORY
                        Set the export path for graph history
155
  --export-csv CSV_FILE
156
                        export stats to a CSV file
157 158
  --export-influxdb
                        export stats to an InfluxDB server
N
Nicolargo 已提交
159 160
  --export-statsd
                        export stats to a Statsd server
161 162 163 164
  -c CLIENT, --client CLIENT
                        connect to a Glances server by IPv4/IPv6 address or
                        hostname
  -s, --server          run Glances in server mode
N
Nicolargo 已提交
165 166 167
  --browser             run the Glances client browser (list of Glances server)
  --disable-autodiscover
                        disable autodiscover feature
168 169 170 171 172 173 174
  -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
  --password-badidea PASSWORD_ARG
                        define password from the command line
  --password            define a client/server password from the prompt or
                        file
N
Nicolargo 已提交
175 176
  --disable-autodiscover
                        Hide Glances server from the auto discover feature
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
  --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]
  -w, --webserver       run Glances in web server mode
  -f PROCESS_FILTER, --process-filter PROCESS_FILTER
                        set the process filter patern (regular expression)
  --process-short-name  force short name for processes name
N
Nicolargo 已提交
193 194 195
  --hide-kernel-threads
                        hide kernel threads in process list
  --tree                display processes as a tree
196 197
  -b, --byte            display network rate in byte per second
  -1, --percpu          start Glances in per CPU mode
198
  --fs-free-space       display FS free space instead of used
199
  --theme-white         optimize display for white background
A
Alessio Sergi 已提交
200

A
Alessio Sergi 已提交
201
Interactive Commands
A
Alessio Sergi 已提交
202 203
--------------------

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

N
Nicolargo 已提交
206 207 208 209 210 211
``ENTER``
    Set the process filter
    Filter is a regular expression pattern:

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

A
Alessio Sergi 已提交
215
    - If CPU iowait ``>60%``, sort processes by I/O read and write
A
Alessio Sergi 已提交
216 217 218
    - If CPU ``>70%``, sort processes by CPU usage
    - If MEM ``>70%``, sort processes by memory usage
``b``
A
Alessio Sergi 已提交
219
    Switch between bit/s or Byte/s for network I/O
A
Alessio Sergi 已提交
220
``c``
A
Alessio Sergi 已提交
221
    Sort processes by CPU usage
A
Alessio Sergi 已提交
222 223
``d``
    Show/hide disk I/O stats
224 225
``e``
    Enable/disable top extended stats
A
Alessio Sergi 已提交
226 227
``f``
    Show/hide file system stats
228 229
``F``
    Switch between FS used and free space
230
``g``
D
desbma 已提交
231
    Generate graphs for current history
A
Alessio Sergi 已提交
232
``h``
A
Alessio Sergi 已提交
233
    Show/hide the help screen
A
Alessio Sergi 已提交
234
``i``
A
Alessio Sergi 已提交
235
    Sort processes by I/O rate
A
Alessio Sergi 已提交
236 237 238
``l``
    Show/hide log messages
``m``
A
Alessio Sergi 已提交
239
    Sort processes by MEM usage
A
Alessio Sergi 已提交
240 241 242 243
``n``
    Show/hide network stats
``p``
    Sort processes by name
N
Nicolargo 已提交
244
``q`` or ``ESC``
D
desbma 已提交
245
    Quit the current Glances session
246 247
``r``
    Reset history
A
Alessio Sergi 已提交
248
``s``
N
Nicolargo 已提交
249
    Show/hide sensors stats
A
Alessio Sergi 已提交
250
``t``
251 252
    Sort process by CPU times (TIME+)
``T``
A
Alessio Sergi 已提交
253
    View network I/O as combination
A
Alessio Sergi 已提交
254
``u``
A
Alessio Sergi 已提交
255
    View cumulative network I/O
A
Alessio Sergi 已提交
256 257 258 259
``w``
    Delete finished warning log messages
``x``
    Delete finished warning and critical log messages
M
Markus Roth 已提交
260
``z``
A
Alessio Sergi 已提交
261
    Show/hide processes stats
A
Alessio Sergi 已提交
262 263
``1``
    Switch between global CPU and per-CPU stats
264 265
``2``
    Enable/disable left sidebar
266 267
``/``
    Switch between short name / command line (processes name)
A
Alessio Sergi 已提交
268

N
Nicolargo 已提交
269
In the Glances client browser (accessible through the --browser command line argument):
N
Nicolargo 已提交
270 271 272 273 274 275 276 277

``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 已提交
278
    Quit Glances
N
Nicolargo 已提交
279

A
Alessio Sergi 已提交
280 281 282
Configuration
=============

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

A
Alessio Sergi 已提交
285
Furthermore a configuration file is needed to set up limits, disks or
286 287
network interfaces to hide and/or monitored processes list or to define
alias.
A
Alessio Sergi 已提交
288 289 290

By default, the configuration file is under:

291 292 293 294 295 296
:Linux: ``/etc/glances/glances.conf``
:\*BSD and OS X: ``/usr/local/etc/glances/glances.conf``
:Windows: ``%APPDATA%\glances\glances.conf``

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

A
Alessio Sergi 已提交
297
::
A
Alessio Sergi 已提交
298

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

301
Since Windows Vista and newer versions:
A
Alessio Sergi 已提交
302

A
Alessio Sergi 已提交
303
::
A
Alessio Sergi 已提交
304

305
    C:\Users\<User>\AppData\Roaming
306 307
    or
    %userprofile%\AppData\Roaming
A
Alessio Sergi 已提交
308

309 310 311
You can override the default configuration, located in one of the above
directories on your system, except for Windows.

A
Alessio Sergi 已提交
312 313
Just copy the ``glances.conf`` file to your ``$XDG_CONFIG_HOME`` directory,
e.g., on Linux:
A
Alessio Sergi 已提交
314 315 316 317

.. code-block:: console

    mkdir -p $XDG_CONFIG_HOME/glances
A
Alessio Sergi 已提交
318
    cp /usr/share/doc/glances/glances.conf $XDG_CONFIG_HOME/glances/
A
Alessio Sergi 已提交
319

A
Alessio Sergi 已提交
320 321
On OS X, you should copy the configuration file to
``~/Library/Application Support/glances/``.
A
Alessio Sergi 已提交
322

323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
*Configuration file description*

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

By default Steal CPU time alerts aren't logged. If you want to enable log/alert, just add:

.. code-block::

    steal_log=True

351 352 353
Logs and debug mode
===================

D
desbma 已提交
354 355 356
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.
357

D
desbma 已提交
358
By default, the log file is under:
359

D
desbma 已提交
360 361
:Linux, \*BSD and OS X: ``/tmp/glances.log``
:Windows: ``%APPDATA%\Local\temp\glances.log``
362

363 364
If glances.log is not writable, a new file will be created and returned to the user console.

A
Alessio Sergi 已提交
365
Anatomy Of The Application
A
Alessio Sergi 已提交
366 367 368 369 370 371 372 373 374 375
==========================

Legend
------

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

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

A
Alessio Sergi 已提交
379 380 381 382 383
Header
------

.. image:: images/header.png

A
Alessio Sergi 已提交
384 385 386
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 已提交
387

A
Alessio Sergi 已提交
388
In client mode, the server connection status is displayed.
N
Nicolargo 已提交
389 390 391 392 393 394

Connected:

.. image:: images/connected.png

Disconnected:
395

N
Nicolargo 已提交
396
.. image:: images/disconnected.png
A
Alessio Sergi 已提交
397 398 399 400 401 402 403 404

CPU
---

Short view:

.. image:: images/cpu.png

A
Alessio Sergi 已提交
405 406
If enough horizontal space is available, extended CPU information are
displayed.
A
Alessio Sergi 已提交
407 408 409 410 411 412 413 414 415

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 已提交
416 417
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 已提交
418

A
Alessio Sergi 已提交
419 420 421 422
| 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 已提交
423

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

A
Alessio Sergi 已提交
427 428 429 430 431
Load
----

.. image:: images/load.png

A
Alessio Sergi 已提交
432
On the *No Sheep* blog, *Zachary Tirrell* defines the load average [1]_:
A
Alessio Sergi 已提交
433 434 435

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

Glances gets the number of CPU core to adapt the alerts.
A
Alessio Sergi 已提交
439 440
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 已提交
441

A
Alessio Sergi 已提交
442 443 444 445
| 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 已提交
446

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

A
Alessio Sergi 已提交
450 451 452
Memory
------

A
Alessio Sergi 已提交
453
Glances uses two columns: one for the ``RAM`` and one for the ``SWAP``.
A
Alessio Sergi 已提交
454 455 456

.. image:: images/mem.png

A
Alessio Sergi 已提交
457 458
If enough space is available, Glances displays extended information for
the ``RAM``:
A
Alessio Sergi 已提交
459 460 461

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

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

A
Alessio Sergi 已提交
464 465 466 467
| 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 已提交
468

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

A
Alessio Sergi 已提交
472 473 474 475 476 477 478 479
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 已提交
480 481
Alerts are only set if the maximum speed per network interface is available
(see sample in the configuration file).
A
Alessio Sergi 已提交
482

A
Alessio Sergi 已提交
483 484
*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 已提交
485
configuration file and aliases for interface name.
N
Nicolas Hennion 已提交
486

A
Alessio Sergi 已提交
487 488 489 490 491 492 493
Disk I/O
--------

.. image:: images/diskio.png

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

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

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

A
Alessio Sergi 已提交
499
File System
A
Alessio Sergi 已提交
500 501 502 503 504 505 506
-----------

.. image:: images/fs.png

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

A
Alessio Sergi 已提交
507
Alerts are set for used disk space.
A
Alessio Sergi 已提交
508

A
Alessio Sergi 已提交
509 510 511 512
| 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 已提交
513

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

N
Nicolargo 已提交
517 518 519
Sensors
-------

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

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

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

A
Alessio Sergi 已提交
528
.. image:: images/sensors.png
N
Nicolargo 已提交
529 530

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

D
desbma 已提交
532
*Note*: limit values and sensors alias names can be defined in the configuration
533
file under the ``[sensors]`` section.
N
Nicolas Hennion 已提交
534

A
Alessio Sergi 已提交
535
Processes List
A
Alessio Sergi 已提交
536 537 538 539 540 541 542 543 544 545
--------------

Compact view:

.. image:: images/processlist.png

Full view:

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

N
Nicolas Hennion 已提交
546
Three views are available for processes:
A
Alessio Sergi 已提交
547 548

* Processes summary
A
Alessio Sergi 已提交
549
* Optional monitored processes list (see below)
N
Nicolas Hennion 已提交
550
* Processes list
A
Alessio Sergi 已提交
551

552 553 554
The processes summary line display:

* Tasks number (total number of processes)
A
Alessio Sergi 已提交
555
* Threads number
556 557 558
* Running tasks number
* Sleeping tasks number
* Other tasks number (not running or sleeping)
N
Nicolargo 已提交
559
* Sort key
560

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

A
Alessio Sergi 已提交
564 565 566 567
* ``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 已提交
568

A
Alessio Sergi 已提交
569 570 571 572 573 574
The number of processes in the list is adapted to the screen size.

``CPU%``
    % of CPU used by the process
``MEM%``
    % of MEM used by the process
N
Nicolargo 已提交
575
``VIRT``
576
    Total program size - Virtual Memory Size (VMS)
N
Nicolargo 已提交
577
``RES``
N
Nicolas Hennion 已提交
578
    Resident Set Size (RSS)
A
Alessio Sergi 已提交
579 580 581
``PID``
    Process ID
``USER``
N
Nicolargo 已提交
582
    User ID
A
Alessio Sergi 已提交
583
``NI``
A
Alessio Sergi 已提交
584
    Nice level of the process (niceness other than 0 is highlighted)
A
Alessio Sergi 已提交
585
``S``
A
Alessio Sergi 已提交
586
    Process status (running process is highlighted)
A
Alessio Sergi 已提交
587 588 589
``TIME+``
    Cumulative CPU time used
``IOR/s``
A
Alessio Sergi 已提交
590
    Per process I/O read rate (in Byte/s)
A
Alessio Sergi 已提交
591
``IOW/s``
A
Alessio Sergi 已提交
592
    Per process I/O write rate (in Byte/s)
N
Nicolargo 已提交
593
``COMMAND``
594
    Process command line
D
desbma 已提交
595
    User cans switch to the process name by pressing on the ``/`` key
A
Alessio Sergi 已提交
596 597 598 599

Process status legend:

``R``
N
Nicolargo 已提交
600
    Running
A
Alessio Sergi 已提交
601
``S``
N
Nicolargo 已提交
602
    Sleeping (may be interrupted)
A
Alessio Sergi 已提交
603
``D``
N
Nicolargo 已提交
604
    Disk sleep (may not be interrupted)
A
Alessio Sergi 已提交
605
``T``
N
Nicolargo 已提交
606
    Traced / Stopped
A
Alessio Sergi 已提交
607
``Z``
N
Nicolargo 已提交
608
    Zombie
A
Alessio Sergi 已提交
609

610 611
In standalone mode, additionals informations are provided for the top process:

N
Nicolargo 已提交
612 613
.. image:: images/processlist-top.png

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

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

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

A
Alessio Sergi 已提交
624
Monitored Processes List
N
Nicolas Hennion 已提交
625 626
------------------------

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

631 632
.. image:: images/monitored.png

N
Nicolas Hennion 已提交
633 634
Each item is defined by:

A
Alessio Sergi 已提交
635 636
* ``description``: description of the processes (max 16 chars).
* ``regex``: regular expression of the processes to monitor.
A
Alessio Sergi 已提交
637 638 639 640 641 642
* ``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 已提交
643 644 645

Up to 10 items can be defined.

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

A
Alessio Sergi 已提交
649
::
N
Nicolas Hennion 已提交
650 651

    [monitor]
652
    list_1_description=Nginx server
N
Nicolas Hennion 已提交
653 654 655 656 657
    list_1_regex=.*nginx.*
    list_1_command=nginx -v
    list_1_countmin=1
    list_1_countmax=4

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

A
Alessio Sergi 已提交
661
::
N
Nicolas Hennion 已提交
662 663

    [monitor]
664
    list_1_description=Nginx server
N
Nicolas Hennion 已提交
665 666 667 668 669 670 671 672 673
    list_1_regex=.*nginx.*
    list_1_command=nginx -v
    list_1_countmin=1
    list_1_countmax=4
    list_1_description=PHP-FPM
    list_1_regex=.*php-fpm.*
    list_1_countmin=1
    list_1_countmax=20

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

678
Alerts are set as following:
679 680

| If number of processes is 0, then status is set to ``"CRITICAL"``
681
| If number of processes is min < current < max, then status is set to ``"OK"``
682 683
| Else status is set to ``"WARNING"``

A
Alessio Sergi 已提交
684 685 686 687 688
Logs
----

.. image:: images/logs.png

A
Alessio Sergi 已提交
689 690
A log messages list is displayed in the bottom of the screen if (and
only if):
A
Alessio Sergi 已提交
691 692 693 694 695 696

- 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 已提交
697 698 699
1. start datetime
2. duration if alert is terminated or `ongoing` if the alert is still in
   progress
A
Alessio Sergi 已提交
700
3. alert name
A
Alessio Sergi 已提交
701 702
4. {min,avg,max} values or number of running processes for monitored
   processes list alerts
A
Alessio Sergi 已提交
703

N
Nicolargo 已提交
704 705 706 707 708 709 710
Docker
------

If you use Docker, Glances can help you to monitor your container. Glances uses the Docker API through the Docker-Py library.

.. image:: images/docker.png

N
Nicolargo 已提交
711 712 713 714 715 716 717
Actions
-------

Glances can trigger actions on events. 

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 已提交
718 719 720 721 722
.. code-block::

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

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

N
Nicolargo 已提交
726 727 728 729 730
.. code-block::

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

N
Nicolargo 已提交
732
*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 已提交
733 734


735 736 737 738
Gateway to others services
==========================

*CSV*
A
Alessio Sergi 已提交
739

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

N
Nicolas Hennion 已提交
742
.. code-block:: console
A
Alessio Sergi 已提交
743

744 745 746 747 748 749 750
    $ glances --export-csv /tmp/glances.csv

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

*InfluxDB*
A
Alessio Sergi 已提交
751

N
Nicolargo 已提交
752
You can export statistics to an InfluxDB server (time series server). The connection should be defined in the Glances configuration file as following:
753

N
Nicolargo 已提交
754 755
.. code-block::

756 757 758 759 760 761 762 763 764 765
    [influxdb]
    host=localhost
    port=8086
    user=root
    password=root
    db=glances

and run Glances with:

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

767
    $ glances --export-influxdb
N
Nicolas Hennion 已提交
768

N
Nicolargo 已提交
769 770 771 772
*Statsd*

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 已提交
773 774
.. code-block::

N
Nicolargo 已提交
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789
    [statsd]
    host=localhost
    port=8125
    prefix=glances

Note: the prefix option is optionnal ('glances by default')

and run Glances with:

.. code-block:: console

    $ glances --export-statsd

Glances will generate stats as:

N
Nicolargo 已提交
790 791
.. code-block::

N
Nicolargo 已提交
792 793 794 795 796 797 798
    'glances.cpu.user': 12.5,
    'glances.cpu.total': 14.9,
    'glances.load.cpucore': 4,
    'glances.load.min1': 0.19,
    ...


799 800 801
APIs Documentations
===================

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

804
APIs documentations are available at:
A
Alessio Sergi 已提交
805

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

A
Alessio Sergi 已提交
809 810 811
Support
=======

N
Nicolargo 已提交
812 813
To post a question about Glances use case, please post it to the offical Q&A `forum`_.

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

N
Nicolargo 已提交
817
Feel free to contribute !
A
Alessio Sergi 已提交
818 819 820


.. [1] http://nosheep.net/story/defining-unix-load-average/
A
Alessio Sergi 已提交
821
.. [2] https://github.com/nicolargo/batinfo
A
Alessio Sergi 已提交
822 823 824

.. _psutil: https://code.google.com/p/psutil/
.. _XML-RPC server: http://docs.python.org/2/library/simplexmlrpcserver.html
D
desbma 已提交
825
.. _RESTFUL-JSON: http://jsonapi.org/
D
desbma 已提交
826
.. _forum: https://groups.google.com/forum/?hl=en#!forum/glances-users