.. _api:
API (Restfull/JSON) documentation
=================================
The Glances Restfull/API server could be ran using the following command line:
.. code-block:: bash
# glances -w --disable-webui
Note: Change request URL api/3 by api/2 if you use Glances 2.x.
GET plugins list
----------------
Get the plugins list::
# curl http://localhost:61208/api/3/pluginslist
['alert',
'amps',
'cloud',
'connections',
'core',
'cpu',
'diskio',
'docker',
'folders',
'fs',
'gpu',
'help',
'ip',
'irq',
'load',
'mem',
'memswap',
'network',
'now',
'percpu',
'ports',
'processcount',
'processlist',
'psutilversion',
'quicklook',
'raid',
'sensors',
'smart',
'system',
'uptime',
'wifi']
GET amps
--------
Get plugin stats::
# curl http://localhost:61208/api/3/amps
[{'count': 0,
'countmax': None,
'countmin': 1.0,
'key': 'name',
'name': 'Dropbox',
'refresh': 3.0,
'regex': True,
'result': None,
'timer': 0.19156432151794434},
{'count': 0,
'countmax': 20.0,
'countmin': None,
'key': 'name',
'name': 'Python',
'refresh': 3.0,
'regex': True,
'result': None,
'timer': 0.19138813018798828}]
Get a specific field::
# curl http://localhost:61208/api/3/amps/name
{'name': ['Dropbox', 'Python', 'Conntrack', 'Nginx', 'Systemd', 'SystemV']}
Get a specific item when field matchs the given value::
# curl http://localhost:61208/api/3/amps/name/Dropbox
{'Dropbox': [{'count': 0,
'countmax': None,
'countmin': 1.0,
'key': 'name',
'name': 'Dropbox',
'refresh': 3.0,
'regex': True,
'result': None,
'timer': 0.19156432151794434}]}
GET core
--------
Get plugin stats::
# curl http://localhost:61208/api/3/core
{'log': 4, 'phys': 2}
Fields descriptions:
* **phys**: Number of physical cores (hyper thread CPUs are excluded) (unit is *number*)
* **log**: Number of logical CPUs. A logical CPU is the number of physical cores multiplied by the number of threads that can run on each core (unit is *number*)
Get a specific field::
# curl http://localhost:61208/api/3/core/phys
{'phys': 2}
GET cpu
-------
Get plugin stats::
# curl http://localhost:61208/api/3/cpu
{'cpucore': 4,
'ctx_switches': 0,
'guest': 0.0,
'guest_nice': 0.0,
'idle': 65.9,
'interrupts': 0,
'iowait': 0.6,
'irq': 0.0,
'nice': 0.0,
'soft_interrupts': 0,
'softirq': 3.3,
'steal': 0.0,
'syscalls': 0,
'system': 3.5,
'time_since_update': 1,
'total': 34.2,
'user': 26.8}
Fields descriptions:
* **total**: Sum of all CPU percentages (except idle) (unit is *percent*)
* **system**: percent time sp