2016-03-02 15:29:19 +03:00
|
|
|
|
.. _influxdb:
|
|
|
|
|
|
|
|
|
|
InfluxDB
|
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
You can export statistics to an ``InfluxDB`` server (time series server).
|
2020-12-23 12:56:02 +03:00
|
|
|
|
|
2021-06-05 10:06:10 +03:00
|
|
|
|
In Glances version 3.2.0 and higher, the way Glances exports stats to
|
2021-05-29 11:38:53 +03:00
|
|
|
|
InfluxDB changes. The following fields will be added as tags:
|
2021-05-29 11:43:26 +03:00
|
|
|
|
|
2021-05-29 11:38:53 +03:00
|
|
|
|
- key stats (for example *interface_name* for network, container *name* for docker...)
|
|
|
|
|
- hostname (shortname)
|
|
|
|
|
- tags
|
|
|
|
|
|
|
|
|
|
Glances InfluxDB data model:
|
|
|
|
|
|
|
|
|
|
+---------------+-----------------------+-----------------------+
|
|
|
|
|
| Measurement | Fields | Tags |
|
|
|
|
|
+===============+=======================+=======================+
|
|
|
|
|
| cpu | user | hostname |
|
|
|
|
|
| | system | |
|
|
|
|
|
| | iowait... | |
|
|
|
|
|
+---------------+-----------------------+-----------------------+
|
2021-06-05 10:06:10 +03:00
|
|
|
|
| network | read_bytes | hostname |
|
|
|
|
|
| | write_bytes | disk_name |
|
|
|
|
|
| | time_since_update... | |
|
|
|
|
|
| | | |
|
|
|
|
|
+---------------+-----------------------+-----------------------+
|
|
|
|
|
| diskio | rx | hostname |
|
|
|
|
|
| | tx | interface_name |
|
|
|
|
|
| | time_since_update... | |
|
|
|
|
|
| | | |
|
2021-05-29 11:38:53 +03:00
|
|
|
|
+---------------+-----------------------+-----------------------+
|
|
|
|
|
| docker | cpu_percent | hostname |
|
|
|
|
|
| | memory_usage... | name |
|
|
|
|
|
+---------------+-----------------------+-----------------------+
|
2021-05-27 18:33:14 +03:00
|
|
|
|
|
2020-12-23 12:56:02 +03:00
|
|
|
|
InfluxDB (up to version 1.7.x)
|
|
|
|
|
------------------------------
|
|
|
|
|
|
2016-03-02 15:29:19 +03:00
|
|
|
|
The connection should be defined in the Glances configuration file as
|
|
|
|
|
following:
|
|
|
|
|
|
|
|
|
|
.. code-block:: ini
|
|
|
|
|
|
|
|
|
|
[influxdb]
|
|
|
|
|
host=localhost
|
|
|
|
|
port=8086
|
2019-07-03 23:13:16 +03:00
|
|
|
|
protocol=http
|
2016-03-02 15:29:19 +03:00
|
|
|
|
user=root
|
|
|
|
|
password=root
|
|
|
|
|
db=glances
|
2020-12-23 12:56:02 +03:00
|
|
|
|
# Prefix will be added for all measurement name
|
|
|
|
|
# Ex: prefix=foo
|
|
|
|
|
# => foo.cpu
|
|
|
|
|
# => foo.mem
|
|
|
|
|
# You can also use dynamic values
|
2021-05-29 11:38:53 +03:00
|
|
|
|
#prefix=foo
|
|
|
|
|
# Followings tags will be added for all measurements
|
|
|
|
|
# You can also use dynamic values.
|
|
|
|
|
# Note: hostname is always added as a tag
|
|
|
|
|
#tags=foo:bar,spam:eggs,domain:`domainname`
|
2016-03-02 15:29:19 +03:00
|
|
|
|
|
|
|
|
|
and run Glances with:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2018-04-02 15:07:23 +03:00
|
|
|
|
$ glances --export influxdb
|
2016-03-02 15:29:19 +03:00
|
|
|
|
|
2017-03-12 20:52:17 +03:00
|
|
|
|
Glances generates a lot of columns, e.g., if you have many running
|
|
|
|
|
Docker containers, so you should use the ``tsm1`` engine in the InfluxDB
|
|
|
|
|
configuration file (no limit on columns number).
|
2016-03-02 15:29:19 +03:00
|
|
|
|
|
2019-07-03 23:13:16 +03:00
|
|
|
|
Note: if you want to use SSL, please set 'protocol=https'.
|
|
|
|
|
|
2020-12-23 12:56:02 +03:00
|
|
|
|
|
|
|
|
|
InfluxDB v2 (from InfluxDB v1.8.x/Flux and InfluxDB v2.x)
|
|
|
|
|
---------------------------------------------------------
|
|
|
|
|
|
2021-05-27 18:33:14 +03:00
|
|
|
|
Note: The InfluxDB v2 client (https://pypi.org/project/influxdb-client/)
|
2020-12-24 11:49:45 +03:00
|
|
|
|
is only available for Python 3.6 or higher.
|
|
|
|
|
|
2020-12-23 12:56:02 +03:00
|
|
|
|
The connection should be defined in the Glances configuration file as
|
|
|
|
|
following:
|
|
|
|
|
|
|
|
|
|
.. code-block:: ini
|
|
|
|
|
|
2021-05-06 23:03:03 +03:00
|
|
|
|
[influxdb2]
|
2020-12-23 12:56:02 +03:00
|
|
|
|
host=localhost
|
|
|
|
|
port=8086
|
|
|
|
|
protocol=http
|
|
|
|
|
org=nicolargo
|
|
|
|
|
bucket=glances
|
|
|
|
|
token=EjFUTWe8U-MIseEAkaVIgVnej_TrnbdvEcRkaB1imstW7gapSqy6_6-8XD-yd51V0zUUpDy-kAdVD1purDLuxA==
|
|
|
|
|
# Prefix will be added for all measurement name
|
|
|
|
|
# Ex: prefix=foo
|
|
|
|
|
# => foo.cpu
|
|
|
|
|
# => foo.mem
|
|
|
|
|
# You can also use dynamic values
|
2021-05-29 11:38:53 +03:00
|
|
|
|
#prefix=foo
|
|
|
|
|
# Followings tags will be added for all measurements
|
|
|
|
|
# You can also use dynamic values.
|
|
|
|
|
# Note: hostname is always added as a tag
|
|
|
|
|
#tags=foo:bar,spam:eggs,domain:`domainname`
|
2020-12-23 12:56:02 +03:00
|
|
|
|
|
|
|
|
|
and run Glances with:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
|
|
$ glances --export influxdb2
|
|
|
|
|
|
|
|
|
|
Note: if you want to use SSL, please set 'protocol=https'.
|
|
|
|
|
|
2016-03-02 15:29:19 +03:00
|
|
|
|
Grafana
|
|
|
|
|
-------
|
|
|
|
|
|
2021-11-28 16:06:08 +03:00
|
|
|
|
For Grafana users, Glances provides a dedicated for `InfluxQL`_ or `Flux`_ InfluxDB datasource.
|
2017-06-04 18:02:45 +03:00
|
|
|
|
|
|
|
|
|
.. image:: ../_static/glances-influxdb.png
|
|
|
|
|
|
|
|
|
|
To use it, just import the file in your ``Grafana`` web interface.
|
2016-03-02 15:29:19 +03:00
|
|
|
|
|
|
|
|
|
.. image:: ../_static/grafana.png
|
|
|
|
|
|
2021-11-28 16:06:08 +03:00
|
|
|
|
.. _InfluxQL: https://github.com/nicolargo/glances/blob/master/conf/glances-grafana-influxql.json
|
|
|
|
|
.. _Flux: https://github.com/nicolargo/glances/blob/master/conf/glances-grafana-flux.json
|