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

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

7
Copyright © 2012-2014 Nicolas Hennion <nicolas@nicolargo.com>
A
Alessio Sergi 已提交
8

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

A
Alessio Sergi 已提交
70 71
In server mode, you can set the bind address ``-B ADDRESS`` and listening
TCP port ``-p PORT``.
A
Alessio Sergi 已提交
72 73 74

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

N
Nicolargo 已提交
75 76
You can also set a password to access to the server ``--password``.

A
Alessio Sergi 已提交
77
Default binding address is ``0.0.0.0`` (Glances will listen on all the
78
available network interfaces) and TCP port is ``61209``.
A
Alessio Sergi 已提交
79 80 81

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

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

A
Alessio Sergi 已提交
85 86
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 已提交
87 88 89

.. code-block:: console

A
Alessio Sergi 已提交
90
    client$ glances -c @snmpserver
N
Nicolargo 已提交
91

92
Note: Stats grabbed by SNMP request are limited.
N
Nicolargo 已提交
93

A
Alessio Sergi 已提交
94 95
Web Server Mode
---------------
N
Nicolargo 已提交
96

A
Alessio Sergi 已提交
97
If you want to remotely monitor a machine, called ``server``, from any
98
device with a web browser, just run on the server:
N
Nicolargo 已提交
99 100 101 102 103

.. code-block:: console

    server$ glances -w

A
Alessio Sergi 已提交
104 105 106
and on the client enter the following URL in your favorite web browser:

::
N
Nicolargo 已提交
107

A
Alessio Sergi 已提交
108
    http://@server:61208
N
Nicolargo 已提交
109 110

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

A
Alessio Sergi 已提交
112 113 114
The Glances web interface follows responsive web design principles.

Screenshot from Chrome on Android
115 116

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

N
Nicolas Hennion 已提交
118

A
Alessio Sergi 已提交
119
Command Reference
A
Alessio Sergi 已提交
120 121
=================

A
Alessio Sergi 已提交
122
Command-Line Options
A
Alessio Sergi 已提交
123 124
--------------------

125 126 127 128 129 130 131 132 133 134 135
  -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
136 137
  --disable-left-sidebar
                        disable left sidebar
138 139
  --disable-process     disable process module
  --disable-log         disable log module
140 141
  --enable-process-extended
                        enable extended stats on top process
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
  --output-csv OUTPUT_CSV
                        export stats to a CSV file
  -c CLIENT, --client CLIENT
                        connect to a Glances server by IPv4/IPv6 address or
                        hostname
  -s, --server          run Glances in server mode
  -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
  --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
  -b, --byte            display network rate in byte per second
  -1, --percpu          start Glances in per CPU mode
173
  --fs-free-space       display FS free space instead of used
174
  --theme-white         optimize display for white background
A
Alessio Sergi 已提交
175

A
Alessio Sergi 已提交
176
Interactive Commands
A
Alessio Sergi 已提交
177 178
--------------------

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

N
Nicolargo 已提交
181 182 183 184 185 186
``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 已提交
187
``a``
A
Alessio Sergi 已提交
188
    Sort process list automatically
A
Alessio Sergi 已提交
189

A
Alessio Sergi 已提交
190
    - If CPU iowait ``>60%``, sort processes by I/O read and write
A
Alessio Sergi 已提交
191 192 193
    - If CPU ``>70%``, sort processes by CPU usage
    - If MEM ``>70%``, sort processes by memory usage
``b``
A
Alessio Sergi 已提交
194
    Switch between bit/s or Byte/s for network I/O
A
Alessio Sergi 已提交
195
``c``
A
Alessio Sergi 已提交
196
    Sort processes by CPU usage
A
Alessio Sergi 已提交
197 198
``d``
    Show/hide disk I/O stats
199 200
``e``
    Enable/disable top extended stats
A
Alessio Sergi 已提交
201 202
``f``
    Show/hide file system stats
203 204
``F``
    Switch between FS used and free space
205
``g``
206
    Generate hraphs for current history
A
Alessio Sergi 已提交
207
``h``
A
Alessio Sergi 已提交
208
    Show/hide the help screen
A
Alessio Sergi 已提交
209
``i``
A
Alessio Sergi 已提交
210
    Sort processes by I/O rate
A
Alessio Sergi 已提交
211 212 213
``l``
    Show/hide log messages
``m``
A
Alessio Sergi 已提交
214
    Sort processes by MEM usage
A
Alessio Sergi 已提交
215 216 217 218
``n``
    Show/hide network stats
``p``
    Sort processes by name
A
Alessio Sergi 已提交
219 220
``q``
    Quit
221 222
``r``
    Reset history
A
Alessio Sergi 已提交
223
``s``
N
Nicolargo 已提交
224
    Show/hide sensors stats
A
Alessio Sergi 已提交
225
``t``
A
Alessio Sergi 已提交
226
    View network I/O as combination
A
Alessio Sergi 已提交
227
``u``
A
Alessio Sergi 已提交
228
    View cumulative network I/O
A
Alessio Sergi 已提交
229 230 231 232
``w``
    Delete finished warning log messages
``x``
    Delete finished warning and critical log messages
M
Markus Roth 已提交
233
``z``
A
Alessio Sergi 已提交
234
    Show/hide processes stats
A
Alessio Sergi 已提交
235 236
``1``
    Switch between global CPU and per-CPU stats
237 238
``2``
    Enable/disable left sidebar
239 240
``/``
    Switch between short name / command line (processes name)
A
Alessio Sergi 已提交
241 242 243 244

Configuration
=============

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

A
Alessio Sergi 已提交
247
Furthermore a configuration file is needed to set up limits, disks or
248 249
network interfaces to hide and/or monitored processes list or to define
alias.
A
Alessio Sergi 已提交
250 251 252

By default, the configuration file is under:

253 254 255 256 257 258
: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 已提交
259
::
A
Alessio Sergi 已提交
260

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

263
Since Windows Vista and newer versions:
A
Alessio Sergi 已提交
264

A
Alessio Sergi 已提交
265
::
A
Alessio Sergi 已提交
266

267
    C:\Users\<User>\AppData\Roaming
268 269
    or
    %userprofile%\AppData\Roaming
A
Alessio Sergi 已提交
270

271 272 273
You can override the default configuration, located in one of the above
directories on your system, except for Windows.

A
Alessio Sergi 已提交
274 275
Just copy the ``glances.conf`` file to your ``$XDG_CONFIG_HOME`` directory,
e.g., on Linux:
A
Alessio Sergi 已提交
276 277 278 279

.. code-block:: console

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

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

285 286 287
Logs and debug mode
===================

D
desbma 已提交
288 289 290
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.
291

D
desbma 已提交
292
By default, the log file is under:
293

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

A
Alessio Sergi 已提交
297
Anatomy Of The Application
A
Alessio Sergi 已提交
298 299 300 301 302 303 304 305 306 307
==========================

Legend
------

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

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

A
Alessio Sergi 已提交
311 312 313 314 315
Header
------

.. image:: images/header.png

A
Alessio Sergi 已提交
316 317 318
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 已提交
319

A
Alessio Sergi 已提交
320
In client mode, the server connection status is displayed.
N
Nicolargo 已提交
321 322 323 324 325 326

Connected:

.. image:: images/connected.png

Disconnected:
327

N
Nicolargo 已提交
328
.. image:: images/disconnected.png
A
Alessio Sergi 已提交
329 330 331 332 333 334 335 336

CPU
---

Short view:

.. image:: images/cpu.png

A
Alessio Sergi 已提交
337 338
If enough horizontal space is available, extended CPU information are
displayed.
A
Alessio Sergi 已提交
339 340 341 342 343 344 345 346 347

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 已提交
348 349
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 已提交
350

A
Alessio Sergi 已提交
351 352 353 354
| 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 已提交
355

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

A
Alessio Sergi 已提交
359 360 361 362 363
Load
----

.. image:: images/load.png

A
Alessio Sergi 已提交
364
On the *No Sheep* blog, *Zachary Tirrell* defines the load average [1]_:
A
Alessio Sergi 已提交
365 366 367

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

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

A
Alessio Sergi 已提交
374 375 376 377
| 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 已提交
378

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

A
Alessio Sergi 已提交
382 383 384
Memory
------

A
Alessio Sergi 已提交
385
Glances uses two columns: one for the ``RAM`` and one for the ``SWAP``.
A
Alessio Sergi 已提交
386 387 388

.. image:: images/mem.png

A
Alessio Sergi 已提交
389 390
If enough space is available, Glances displays extended information for
the ``RAM``:
A
Alessio Sergi 已提交
391 392 393

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

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

A
Alessio Sergi 已提交
396 397 398 399
| 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 已提交
400

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

A
Alessio Sergi 已提交
404 405 406 407 408 409 410 411
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 已提交
412 413
Alerts are only set if the maximum speed per network interface is available
(see sample in the configuration file).
A
Alessio Sergi 已提交
414

A
Alessio Sergi 已提交
415 416
*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 已提交
417
configuration file and aliases for interface name.
N
Nicolas Hennion 已提交
418

A
Alessio Sergi 已提交
419 420 421 422 423 424 425
Disk I/O
--------

.. image:: images/diskio.png

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

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

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

A
Alessio Sergi 已提交
431
File System
A
Alessio Sergi 已提交
432 433 434 435 436 437 438
-----------

.. image:: images/fs.png

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

A
Alessio Sergi 已提交
439
Alerts are set for used disk space.
A
Alessio Sergi 已提交
440

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

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

N
Nicolargo 已提交
449 450 451
Sensors
-------

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

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

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

A
Alessio Sergi 已提交
460
.. image:: images/sensors.png
N
Nicolargo 已提交
461 462

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

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

A
Alessio Sergi 已提交
467
Processes List
A
Alessio Sergi 已提交
468 469 470 471 472 473 474 475 476 477
--------------

Compact view:

.. image:: images/processlist.png

Full view:

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

N
Nicolas Hennion 已提交
478
Three views are available for processes:
A
Alessio Sergi 已提交
479 480

* Processes summary
A
Alessio Sergi 已提交
481
* Optional monitored processes list (see below)
N
Nicolas Hennion 已提交
482
* Processes list
A
Alessio Sergi 已提交
483

484 485 486
The processes summary line display:

* Tasks number (total number of processes)
A
Alessio Sergi 已提交
487
* Threads number
488 489 490
* Running tasks number
* Sleeping tasks number
* Other tasks number (not running or sleeping)
N
Nicolargo 已提交
491
* Sort key
492

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

A
Alessio Sergi 已提交
496 497 498 499
* ``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 已提交
500

A
Alessio Sergi 已提交
501 502 503 504 505 506
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 已提交
507
``VIRT``
508
    Total program size - Virtual Memory Size (VMS)
N
Nicolargo 已提交
509
``RES``
N
Nicolas Hennion 已提交
510
    Resident Set Size (RSS)
A
Alessio Sergi 已提交
511 512 513
``PID``
    Process ID
``USER``
N
Nicolargo 已提交
514
    User ID
A
Alessio Sergi 已提交
515
``NI``
A
Alessio Sergi 已提交
516
    Nice level of the process (niceness other than 0 is highlighted)
A
Alessio Sergi 已提交
517
``S``
A
Alessio Sergi 已提交
518
    Process status (running process is highlighted)
A
Alessio Sergi 已提交
519 520 521
``TIME+``
    Cumulative CPU time used
``IOR/s``
A
Alessio Sergi 已提交
522
    Per process I/O read rate (in Byte/s)
A
Alessio Sergi 已提交
523
``IOW/s``
A
Alessio Sergi 已提交
524
    Per process I/O write rate (in Byte/s)
N
Nicolargo 已提交
525
``COMMAND``
526
    Process command line
D
desbma 已提交
527
    User cans switch to the process name by pressing on the ``/`` key
A
Alessio Sergi 已提交
528 529 530 531

Process status legend:

``R``
N
Nicolargo 已提交
532
    Running
A
Alessio Sergi 已提交
533
``S``
N
Nicolargo 已提交
534
    Sleeping (may be interrupted)
A
Alessio Sergi 已提交
535
``D``
N
Nicolargo 已提交
536
    Disk sleep (may not be interrupted)
A
Alessio Sergi 已提交
537
``T``
N
Nicolargo 已提交
538
    Traced / Stopped
A
Alessio Sergi 已提交
539
``Z``
N
Nicolargo 已提交
540
    Zombie
A
Alessio Sergi 已提交
541

542 543
In standalone mode, additionals informations are provided for the top process:

N
Nicolargo 已提交
544 545
.. image:: images/processlist-top.png

546 547 548
* CPU affinity (number of cores used by the process)
* Extended memory information (swap, shared, text, lib, data and dirty on Linux)
* Openned threads, files and network sessions (TCP and UDP)
D
desbma 已提交
549
* IO nice level
550

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

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

A
Alessio Sergi 已提交
556
Monitored Processes List
N
Nicolas Hennion 已提交
557 558
------------------------

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

563 564
.. image:: images/monitored.png

N
Nicolas Hennion 已提交
565 566
Each item is defined by:

A
Alessio Sergi 已提交
567 568
* ``description``: description of the processes (max 16 chars).
* ``regex``: regular expression of the processes to monitor.
A
Alessio Sergi 已提交
569 570 571 572 573 574
* ``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 已提交
575 576 577

Up to 10 items can be defined.

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

A
Alessio Sergi 已提交
581
::
N
Nicolas Hennion 已提交
582 583

    [monitor]
584
    list_1_description=Nginx server
N
Nicolas Hennion 已提交
585 586 587 588 589
    list_1_regex=.*nginx.*
    list_1_command=nginx -v
    list_1_countmin=1
    list_1_countmax=4

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

A
Alessio Sergi 已提交
593
::
N
Nicolas Hennion 已提交
594 595

    [monitor]
596
    list_1_description=Nginx server
N
Nicolas Hennion 已提交
597 598 599 600 601 602 603 604 605
    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

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

610
Alerts are set as following:
611 612

| If number of processes is 0, then status is set to ``"CRITICAL"``
613
| If number of processes is min < current < max, then status is set to ``"OK"``
614 615
| Else status is set to ``"WARNING"``

A
Alessio Sergi 已提交
616 617 618 619 620
Logs
----

.. image:: images/logs.png

A
Alessio Sergi 已提交
621 622
A log messages list is displayed in the bottom of the screen if (and
only if):
A
Alessio Sergi 已提交
623 624 625 626 627 628

- 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 已提交
629 630 631
1. start datetime
2. duration if alert is terminated or `ongoing` if the alert is still in
   progress
A
Alessio Sergi 已提交
632
3. alert name
A
Alessio Sergi 已提交
633 634
4. {min,avg,max} values or number of running processes for monitored
   processes list alerts
A
Alessio Sergi 已提交
635

A
Alessio Sergi 已提交
636 637
Other Outputs
=============
A
Alessio Sergi 已提交
638

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

N
Nicolas Hennion 已提交
641
.. code-block:: console
A
Alessio Sergi 已提交
642

N
Nicolargo 已提交
643
    $ glances --output-csv /tmp/glances.csv
A
Alessio Sergi 已提交
644

N
Nicolargo 已提交
645
CSV files have two lines per stats:
A
Alessio Sergi 已提交
646

N
Nicolargo 已提交
647 648
- Stats description
- Stats (comma separated)
N
Nicolas Hennion 已提交
649

650 651 652 653
APIs Documentations
===================

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

655
APIs documentations are available at:
A
Alessio Sergi 已提交
656

657 658
- XML-RPC: https://github.com/nicolargo/glances/wiki/The-Glances-2.x-API-How-to
- RESTFULL-JSON: https://github.com/nicolargo/glances/wiki/The-Glances-RESTFULL-JSON-API
N
Nicolas Hennion 已提交
659

A
Alessio Sergi 已提交
660 661 662
Support
=======

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

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

N
Nicolargo 已提交
668
Feel free to contribute !
A
Alessio Sergi 已提交
669 670 671


.. [1] http://nosheep.net/story/defining-unix-load-average/
A
Alessio Sergi 已提交
672
.. [2] https://github.com/nicolargo/batinfo
A
Alessio Sergi 已提交
673 674 675

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