2016-03-02 15:29:19 +03:00
|
|
|
.. _elastic:
|
|
|
|
|
|
|
|
Elasticsearch
|
|
|
|
=============
|
|
|
|
|
2017-03-12 20:52:17 +03:00
|
|
|
You can export statistics to an ``Elasticsearch`` server. The connection
|
2016-03-02 15:29:19 +03:00
|
|
|
should be defined in the Glances configuration file as following:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
|
|
|
|
|
|
|
[elasticsearch]
|
|
|
|
host=localhost
|
|
|
|
port=9200
|
|
|
|
index=glances
|
|
|
|
|
|
|
|
and run Glances with:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ glances --export-elasticsearch
|
|
|
|
|
|
|
|
The stats are available through the elasticsearch API. For example, to
|
|
|
|
get the CPU system stats:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ curl http://172.17.0.2:9200/glances/cpu/system
|
|
|
|
{
|
|
|
|
"_index": "glances",
|
|
|
|
"_type": "cpu",
|
|
|
|
"_id": "system",
|
|
|
|
"_version": 28,
|
|
|
|
"found": true,"
|
|
|
|
_source": {
|
|
|
|
"timestamp": "2016-02-04T14:11:02.362232",
|
|
|
|
"value": "2.2"
|
|
|
|
}
|
|
|
|
}
|