2017-07-30 12:05:49 +03:00
|
|
|
.. _restful:
|
|
|
|
|
2018-02-15 21:45:45 +03:00
|
|
|
RESTful
|
2017-07-30 12:05:49 +03:00
|
|
|
=======
|
|
|
|
|
2018-02-15 21:45:45 +03:00
|
|
|
You can export statistics to a ``RESTful`` JSON server. All the available stats
|
|
|
|
will be exported in one big (~15 KB) POST request to the RESTful endpoint.
|
2017-07-30 12:05:49 +03:00
|
|
|
|
2018-02-15 21:45:45 +03:00
|
|
|
The RESTful endpoint should be defined in the Glances configuration file as
|
2017-07-30 12:05:49 +03:00
|
|
|
following:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
|
|
|
|
|
|
|
[restful]
|
|
|
|
# Configuration for the --export-restful option
|
|
|
|
# Example, export to http://localhost:6789/
|
|
|
|
host=localhost
|
|
|
|
port=6789
|
|
|
|
protocol=http
|
|
|
|
path=/
|
|
|
|
|
|
|
|
URL Syntax:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
|
|
|
|
|
|
|
http://localhost:6789/
|
|
|
|
| | | |
|
|
|
|
| | | path
|
|
|
|
| | port
|
2017-07-30 12:14:18 +03:00
|
|
|
| host
|
|
|
|
protocol
|
2017-07-30 12:05:49 +03:00
|
|
|
|
|
|
|
and run Glances with:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2018-04-02 15:07:23 +03:00
|
|
|
$ glances --export restful
|
2017-07-30 12:05:49 +03:00
|
|
|
|
|
|
|
Glances will generate stats as a big JSON dictionary (see example `here`_).
|
|
|
|
|
|
|
|
|
|
|
|
.. _here: https://pastebin.com/7U3vXqvF
|