File: prometheus.rst

package info (click to toggle)
glances 3.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,944 kB
  • sloc: javascript: 26,103; python: 11,238; makefile: 229; sh: 169
file content (42 lines) | stat: -rw-r--r-- 1,076 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.. _prometheus:

Prometheus
==========

You can export statistics to a ``Prometheus`` server through an exporter.
When the *--export-prometheus* is used, Glances creates a Prometheus exporter
listening on <host:port> (define in the Glances configuration file).

.. code-block:: ini

    [prometheus]
    host=localhost
    port=9091
    prefix=glances
    labels=src:glances

Note: you can use dynamc fields for the label (ex: labels=system:`uname -s`)

and run Glances with:

.. code-block:: console

    $ glances --export prometheus

You can check that Glances exports the stats using this URL: http://localhost:9091

.. image:: ../_static/prometheus_exporter.png

In order to store the metrics in a Prometheus server, you should add this
exporter to your Prometheus server configuration with the following lines
(in the prometheus.yml configuration file):

.. code-block:: ini

    scrape_configs:
      - job_name: 'glances_exporter'
        scrape_interval: 5s
        static_configs:
          - targets: ['localhost:9091']

.. image:: ../_static/prometheus_server.png