2016-03-02 12:29:19 +00:00
|
|
|
.. _influxdb:
|
|
|
|
|
|
|
|
InfluxDB
|
|
|
|
========
|
|
|
|
|
|
|
|
You can export statistics to an ``InfluxDB`` server (time series server).
|
2020-12-23 09:56:02 +00:00
|
|
|
|
2021-05-27 15:33:14 +00:00
|
|
|
In Glances version 3.1.8 and higher, the value of the key field will be
|
|
|
|
converted as a tag. For example, in the Docker plugin, the key = name,
|
|
|
|
so the container name will be tag and not a field.
|
|
|
|
|
2020-12-23 09:56:02 +00:00
|
|
|
InfluxDB (up to version 1.7.x)
|
|
|
|
------------------------------
|
|
|
|
|
2016-03-02 12:29:19 +00:00
|
|
|
The connection should be defined in the Glances configuration file as
|
|
|
|
following:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
|
|
|
|
|
|
|
[influxdb]
|
|
|
|
host=localhost
|
|
|
|
port=8086
|
2019-07-03 20:13:16 +00:00
|
|
|
protocol=http
|
2016-03-02 12:29:19 +00:00
|
|
|
user=root
|
|
|
|
password=root
|
|
|
|
db=glances
|
2020-12-23 09:56:02 +00:00
|
|
|
# Prefix will be added for all measurement name
|
|
|
|
# Ex: prefix=foo
|
|
|
|
# => foo.cpu
|
|
|
|
# => foo.mem
|
|
|
|
# You can also use dynamic values
|
|
|
|
#prefix=`hostname`
|
|
|
|
prefix=localhost
|
2020-02-27 14:17:24 +00:00
|
|
|
# Tags will be added for all measurements
|
|
|
|
#tags=foo:bar,spam:eggs
|
|
|
|
# You can also use dynamic values
|
|
|
|
#tags=system:`uname -s`
|
2016-03-02 12:29:19 +00:00
|
|
|
|
|
|
|
and run Glances with:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2018-04-02 12:07:23 +00:00
|
|
|
$ glances --export influxdb
|
2016-03-02 12:29:19 +00:00
|
|
|
|
2017-03-12 17:52:17 +00: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 12:29:19 +00:00
|
|
|
|
2019-07-03 20:13:16 +00:00
|
|
|
Note: if you want to use SSL, please set 'protocol=https'.
|
|
|
|
|
2020-12-23 09:56:02 +00:00
|
|
|
|
|
|
|
InfluxDB v2 (from InfluxDB v1.8.x/Flux and InfluxDB v2.x)
|
|
|
|
---------------------------------------------------------
|
|
|
|
|
2021-05-27 15:33:14 +00:00
|
|
|
Note: The InfluxDB v2 client (https://pypi.org/project/influxdb-client/)
|
2020-12-24 08:49:45 +00:00
|
|
|
is only available for Python 3.6 or higher.
|
|
|
|
|
2020-12-23 09:56:02 +00:00
|
|
|
The connection should be defined in the Glances configuration file as
|
|
|
|
following:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
|
|
|
|
2021-05-06 20:03:03 +00:00
|
|
|
[influxdb2]
|
2020-12-23 09:56:02 +00: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
|
|
|
|
#prefix=`hostname`
|
|
|
|
prefix=localhost
|
|
|
|
# Tags will be added for all measurements
|
|
|
|
#tags=foo:bar,spam:eggs
|
|
|
|
# You can also use dynamic values
|
|
|
|
#tags=system:`uname -s`
|
|
|
|
|
|
|
|
and run Glances with:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ glances --export influxdb2
|
|
|
|
|
|
|
|
Note: if you want to use SSL, please set 'protocol=https'.
|
|
|
|
|
2016-03-02 12:29:19 +00:00
|
|
|
Grafana
|
|
|
|
-------
|
|
|
|
|
2017-06-04 15:02:45 +00:00
|
|
|
For Grafana users, Glances provides a dedicated `dashboard`_.
|
|
|
|
|
|
|
|
.. image:: ../_static/glances-influxdb.png
|
|
|
|
|
|
|
|
To use it, just import the file in your ``Grafana`` web interface.
|
2016-03-02 12:29:19 +00:00
|
|
|
|
|
|
|
.. image:: ../_static/grafana.png
|
|
|
|
|
|
|
|
.. _dashboard: https://github.com/nicolargo/glances/blob/master/conf/glances-grafana.json
|