diff options
Diffstat (limited to 'docs/api.rst')
-rw-r--r-- | docs/api.rst | 581 |
1 files changed, 329 insertions, 252 deletions
diff --git a/docs/api.rst b/docs/api.rst index f88b4715..708a105c 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -12,12 +12,14 @@ The Glances Restfull/API server could be ran using the following command line: API URL ------- -The default root API URL is ``http://localhost:61208/api/3``. +The default root API URL is ``http://localhost:61208/api/4``. The bind address and port could be changed using the ``--bind`` and ``--port`` command line options. It is also possible to define an URL prefix using the ``url_prefix`` option from the [outputs] section -of the Glances configuration file. The url_prefix should always end with a slash (``/``). +of the Glances configuration file. + +Note: The url_prefix should always end with a slash (``/``). For example: @@ -25,19 +27,30 @@ For example: [outputs] url_prefix = /glances/ -will change the root API URL to ``http://localhost:61208/glances/api/3`` and the Web UI URL to +will change the root API URL to ``http://localhost:61208/glances/api/4`` and the Web UI URL to ``http://localhost:61208/glances/`` +API documentation +----------------- + +The API documentation is available at the following URL: ``http://localhost:61208/docs#/``. + +WebUI refresh +------------- + +It is possible to change the Web UI refresh rate (default is 2 seconds) using the following option in the URL: +``http://localhost:61208/glances/?refresh=5`` + GET API status -------------- This entry point should be used to check the API status. -It will return nothing but a 200 return code if everything is OK. +It will the Glances version and a 200 return code if everything is OK. Get the Rest API status:: - # curl -I http://localhost:61208/api/3/status + # curl -I http://localhost:61208/api/4/status "HTTP/1.0 200 OK" GET plugins list @@ -45,7 +58,7 @@ GET plugins list Get the plugins list:: - # curl http://localhost:61208/api/3/pluginslist + # curl http://localhost:61208/api/4/pluginslist ["alert", "amps", "cloud", @@ -76,14 +89,34 @@ Get the plugins list:: "smart", "system", "uptime", + "version", "wifi"] +GET alert +--------- + +Get plugin stats:: + + # curl http://localhost:61208/api/4/alert + [[1702733581.0, + -1, + "WARNING", + "MEM", + 80.72395821062744, + 80.72395821062744, + 80.72395821062744, + 80.72395821062744, + 1, + [], + "", + "memory_percent"]] + GET amps -------- Get plugin stats:: - # curl http://localhost:61208/api/3/amps + # curl http://localhost:61208/api/4/amps [{"count": 0, "countmax": None, "countmin": 1.0, @@ -92,7 +125,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.1688997745513916}, + "timer": 0.30402588844299316}, {"count": 0, "countmax": 20.0, "countmin": None, @@ -101,16 +134,16 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.1687941551208496}] + "timer": 0.3038666248321533}] Get a specific field:: - # curl http://localhost:61208/api/3/amps/name + # curl http://localhost:61208/api/4/amps/name {"name": ["Dropbox", "Python", "Conntrack", "Nginx", "Systemd", "SystemV"]} Get a specific item when field matches the given value:: - # curl http://localhost:61208/api/3/amps/name/Dropbox + # curl http://localhost:61208/api/4/amps/name/Dropbox {"Dropbox": [{"count": 0, "countmax": None, "countmin": 1.0, @@ -119,19 +152,19 @@ Get a specific item when field matches the given value:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.1688997745513916}]} + "timer": 0.30402588844299316}]} GET connections --------------- Get plugin stats:: - # curl http://localhost:61208/api/3/connections + # curl http://localhost:61208/api/4/connections {"net_connections_enabled": True, "nf_conntrack_enabled": True} Get a specific field:: - # curl http://localhost:61208/api/3/connections/net_connections_enabled + # curl http://localhost:61208/api/4/connections/net_connections_enabled {"net_connections_enabled": True} GET containers @@ -139,51 +172,72 @@ GET containers Get plugin stats:: - # curl http://localhost:61208/api/3/containers - {"containers": [{"Command": ["/usr/local/bin/entrypoint", "/sbin/init"], - "Created": "2023-09-23T08:45:37.9847178Z", - "Id": "3b375dd5868fa54c30dd67ca296cf27885404194b478f82c20fbfae609c20d85", - "Image": ["gcr.io/k8s-minikube/kicbase:v0.0.40"], + # curl http://localhost:61208/api/4/containers + {"containers": [{"Command": ["/portainer"], + "Created": "2022-10-29T14:59:10.266701439Z", + "Id": "3abd51c615968482d9ccff5afc629f267f6dda113ed68b75b432615fae3b49fb", + "Image": ["portainer/portainer-ce:2.9.3"], "Status": "running", - "Uptime": "1 weeks", + "Uptime": "3 weeks", "cpu": {"total": 0.0}, "cpu_percent": 0.0, "engine": "docker", - "io": {"cumulative_ior": 97918976, - "cumulative_iow": 188833792}, + "io": {"cumulative_ior": 1904640, "cumulative_iow": 2256896}, "io_r": None, "io_w": None, "key": "name", "memory": {"cache": None, - "limit": 2306867200, + "limit": 7823585280, "max_usage": None, "rss": None, - "usage": 717176832}, - "memory_usage": 717176832, - "name": "minikube", - "network": {"cumulative_rx": 6072033, - "cumulative_tx": 89450523}, + "usage": 13836288}, + "memory_usage": 13836288, + "name": "portainer", + "network": {"cumulative_rx": 7106388, "cumulative_tx": 0}, "network_rx": None, "network_tx": None}, - {"Command": ["/portainer"], - "Created": "2022-10-29T14:59:10.266701439Z", - "Id": "3abd51c615968482d9ccff5afc629f267f6dda113ed68b75b432615fae3b49fb", - "Image": ["portainer/portainer-ce:2.9.3"], + {"Command": ["top"], + "Created": "2023-12-09T10:45:34.339489876+01:00", + "Id": "481d6ffb7eef284d062628cf350bdd9ce0a803db8a2a505d75565ed24322b714", + "Image": "["docker.io/library/ubuntu:latest"]", "Status": "running", - "Uptime": "2 weeks", - "cpu": {"total": 0.0}, - "cpu_percent": 0.0, - "engine": "docker", - "io": {}, - "io_r": None, - "io_w": None, + "Uptime": "1 weeks", + "cpu": {"total": 6.604897042562196e-07}, + "cpu_percent": 6.604897042562196e-07, + "engine": "podman", + "io": {"ior": 0.0, "iow": 0.0, "time_since_update": 1}, + "io_r": 0.0, + "io_w": 0.0, "key": "name", - "memory": {}, - "memory_usage": None, - "name": "portainer", - "network": {}, - "network_rx": None, - "network_tx": None}], + "memory": {"limit": 7823585280.0, "usage": 1441792.0}, + "memory_usage": 1441792.0, + "name": "sad_darwin", + "network": {"rx": 0.0, "time_since_update": 1, "tx": 0.0}, + "network_rx": 0.0, + "network_tx": 0.0, + "pod_id": "8d0f1c783def", + "pod_name": "sad_darwin"}, + {"Command": [], + "Created": "2022-10-22T14:23:03.120912374+02:00", + "Id": "9491515251edcd5bb5dc17205d7ee573c0be96fe0b08b0a12a7e2cea874565ea", + "Image": "["k8s.gcr.io/pause:3.5"]", + "Status": "running", + "Uptime": "1 weeks", + "cpu": {"total": 3.231862023627245e-10}, + "cpu_percent": 3.231862023627245e-10, + "engine": "podman", + "io": {"ior": 0.0, "iow": 0.0, "time_since_update": 1}, + "io_r": 0.0, + "io_w": 0.0, + "key": "name", + "memory": {"limit": 7823585280.0, "usage": 368640.0}, + "memory_usage": 368640.0, + "name": "8d0f1c783def-infra", + "network": {"rx": 0.0, "time_since_update": 1, "tx": 0.0}, + "network_rx": 0.0, + "network_tx": 0.0, + "pod_id": "8d0f1c783def", + "pod_name": "8d0f1c783def-infra"}], "version": {}, "version_podman": {}} @@ -192,7 +246,7 @@ GET core Get plugin stats:: - # curl http://localhost:61208/api/3/core + # curl http://localhost:61208/api/4/core {"log": 4, "phys": 2} Fields descriptions: @@ -202,7 +256,7 @@ Fields descriptions: Get a specific field:: - # curl http://localhost:61208/api/3/core/phys + # curl http://localhost:61208/api/4/core/phys {"phys": 2} GET cpu @@ -210,24 +264,24 @@ GET cpu Get plugin stats:: - # curl http://localhost:61208/api/3/cpu + # curl http://localhost:61208/api/4/cpu {"cpucore": 4, "ctx_switches": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 66.9, + "idle": 73.7, "interrupts": 0, - "iowait": 0.8, + "iowait": 0.2, "irq": 0.0, "nice": 0.0, "soft_interrupts": 0, - "softirq": 0.8, + "softirq": 0.0, "steal": 0.0, "syscalls": 0, - "system": 7.6, + "system": 2.0, "time_since_update": 1, - "total": 32.2, - "user": 23.7} + "total": 26.2, + "user": 24.2} Fields descriptions: @@ -249,15 +303,15 @@ Fields descriptions: Get a specific field:: - # curl http://localhost:61208/api/3/cpu/total - {"total": 32.2} + # curl http://localhost:61208/api/4/cpu/total + {"total": 26.2} GET diskio ---------- Get plugin stats:: - # curl http://localhost:61208/api/3/diskio + # curl http://localhost:61208/api/4/diskio [{"disk_name": "sda", "key": "disk_name", "read_bytes": 0, @@ -275,12 +329,12 @@ Get plugin stats:: Get a specific field:: - # curl http://localhost:61208/api/3/diskio/disk_name + # curl http://localhost:61208/api/4/diskio/disk_name {"disk_name": ["sda", "sda1", "sda2", "sda5", "dm-0", "dm-1"]} Get a specific item when field matches the given value:: - # curl http://localhost:61208/api/3/diskio/disk_name/sda + # curl http://localhost:61208/api/4/diskio/disk_name/sda {"sda": [{"disk_name": "sda", "key": "disk_name", "read_bytes": 0, @@ -294,69 +348,66 @@ GET fs Get plugin stats:: - # curl http://localhost:61208/api/3/fs + # curl http://localhost:61208/api/4/fs [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 18324307968, + "free": 26169372672, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 92.1, + "percent": 88.7, "size": 243334156288, - "used": 212622393344}, + "used": 204777328640}, {"device_name": "zsfpool", - "free": 41811968, + "free": 31195136, "fs_type": "zfs", "key": "mnt_point", "mnt_point": "/zsfpool", - "percent": 0.3, - "size": 41943040, - "used": 131072}] + "percent": 25.4, + "size": 41811968, + "used": 10616832}] Get a specific field:: - # curl http://localhost:61208/api/3/fs/mnt_point + # curl http://localhost:61208/api/4/fs/mnt_point {"mnt_point": ["/", "/zsfpool", "/var/snap/firefox/common/host-hunspell"]} Get a specific item when field matches the given value:: - # curl http://localhost:61208/api/3/fs/mnt_point// + # curl http://localhost:61208/api/4/fs/mnt_point// {"/": [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 18324307968, + "free": 26169372672, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 92.1, + "percent": 88.7, "size": 243334156288, - "used": 212622393344}]} + "used": 204777328640}]} GET ip ------ Get plugin stats:: - # curl http://localhost:61208/api/3/ip - {"address": "192.168.0.32", - "gateway": "192.168.0.254", + # curl http://localhost:61208/api/4/ip + {"address": "192.168.1.14", + "gateway": "192.168.1.1", "mask": "255.255.255.0", "mask_cidr": 24, - "public_address": "91.166.228.228", + "public_address": "92.151.148.66", "public_info_human": ""} Get a specific field:: - # curl http://localhost:61208/api/3/ip/gateway - {"gateway": "192.168.0.254"} + # curl http://localhost:61208/api/4/ip/gateway + {"gateway": "192.168.1.1"} GET load -------- Get plugin stats:: - # curl http://localhost:61208/api/3/load - {"cpucore": 4, - "min1": 1.2158203125, - "min15": 1.14794921875, - "min5": 1.13916015625} + # curl http://localhost:61208/api/4/load + {"cpucore": 4, "min1": 1.3134765625, "min15": 1.35009765625, "min5": 1.5234375} Fields descriptions: @@ -367,25 +418,25 @@ Fields descriptions: Get a specific field:: - # curl http://localhost:61208/api/3/load/min1 - {"min1": 1.2158203125} + # curl http://localhost:61208/api/4/load/min1 + {"min1": 1.3134765625} GET mem ------- Get plugin stats:: - # curl http://localhost:61208/api/3/mem - {"active": 2829647872, - "available": 1697103872, - "buffers": 98603008, - "cached": 2016976896, - "free": 1697103872, - "inactive": 3575861248, - "percent": 78.3, - "shared": 469102592, - "total": 7823601664, - "used": 6126497792} + # curl http://localhost:61208/api/4/mem + {"active": 3005665280, + "available": 1508077568, + "buffers": 124248064, + "cached": 1833496576, + "free": 1508077568, + "inactive": 3188097024, + "percent": 80.7, + "shared": 559996928, + "total": 7823585280, + "used": 6315507712} Fields descriptions: @@ -403,22 +454,22 @@ Fields descriptions: Get a specific field:: - # curl http://localhost:61208/api/3/mem/total - {"total": 7823601664} + # curl http://localhost:61208/api/4/mem/total + {"total": 7823585280} GET memswap ----------- Get plugin stats:: - # curl http://localhost:61208/api/3/memswap - {"free": 3605164032, - "percent": 55.4, - "sin": 19573440512, - "sout": 27570544640, + # curl http://localhost:61208/api/4/memswap + {"free": 4914995200, + "percent": 39.2, + "sin": 6458191872, + "sout": 11348365312, "time_since_update": 1, "total": 8082419712, - "used": 4477255680} + "used": 3167424512} Fields descriptions: @@ -432,7 +483,7 @@ Fields descriptions: Get a specific field:: - # curl http://localhost:61208/api/3/memswap/total + # curl http://localhost:61208/api/4/memswap/total {"total": 8082419712} GET network @@ -440,11 +491,11 @@ GET network Get plugin stats:: - # curl http://localhost:61208/api/3/network + # curl http://localhost:61208/api/4/network [{"alias": None, - "cumulative_cx": 1329145058, - "cumulative_rx": 664572529, - "cumulative_tx": 664572529, + "cumulative_cx": 1492376856, + "cumulative_rx": 746188428, + "cumulative_tx": 746188428, "cx": 0, "interface_name": "lo", "is_up": True, @@ -454,17 +505,17 @@ Get plugin stats:: "time_since_update": 1, "tx": 0}, {"alias": None, - "cumulative_cx": 17462918931, - "cumulative_rx": 16928655854, - "cumulative_tx": 534263077, - "cx": 424, + "cumulative_cx": 5862371250, + "cumulative_rx": 5524324325, + "cumulative_tx": 338046925, + "cx": 224, "interface_name": "wlp2s0", "is_up": True, "key": "interface_name", - "rx": 184, + "rx": 98, "speed": 0, "time_since_update": 1, - "tx": 240}] + "tx": 126}] Fields descriptions: @@ -482,29 +533,22 @@ Fields descriptions: Get a specific field:: - # curl http://localhost:61208/api/3/network/interface_name + # curl http://localhost:61208/api/4/network/interface_name {"interface_name": ["lo", "wlp2s0", - "br_grafana", - "docker0", - "veth6cdd773", - "veth0ada394", - "mpqemubr0", - "vboxnet0", - "br-66c7462713f6", - "veth268b5e5", - "veth93720a7", - "vethf4737f4", "br-40875d2e2716", - "veth1df26b1"]} + "docker0", + "br_grafana", + "veth55598fc", + "mpqemubr0"]} Get a specific item when field matches the given value:: - # curl http://localhost:61208/api/3/network/interface_name/lo + # curl http://localhost:61208/api/4/network/interface_name/lo {"lo": [{"alias": None, - "cumulative_cx": 1329145058, - "cumulative_rx": 664572529, - "cumulative_tx": 664572529, + "cumulative_cx": 1492376856, + "cumulative_rx": 746188428, + "cumulative_tx": 746188428, "cx": 0, "interface_name": "lo", "is_up": True, @@ -519,45 +563,45 @@ GET now Get plugin stats:: - # curl http://localhost:61208/api/3/now - "2023-10-07 10:23:53 CEST" + # curl http://localhost:61208/api/4/now + "2023-12-16 14:33:01 CET" GET percpu ---------- Get plugin stats:: - # curl http://localhost:61208/api/3/percpu + # curl http://localhost:61208/api/4/percpu [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 11.0, + "idle": 97.1, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 4.0, - "total": 89.0, - "user": 15.0}, + "system": 1.4, + "total": 2.9, + "user": 1.4}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 19.0, - "iowait": 1.0, + "idle": 96.4, + "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 1.0, - "total": 81.0, - "user": 8.0}] + "system": 1.4, + "total": 3.6, + "user": 2.2}] Get a specific field:: - # curl http://localhost:61208/api/3/percpu/cpu_number + # curl http://localhost:61208/api/4/percpu/cpu_number {"cpu_number": [0, 1, 2, 3]} GET ports @@ -565,130 +609,130 @@ GET ports Get plugin stats:: - # curl http://localhost:61208/api/3/ports + # curl http://localhost:61208/api/4/ports [{"description": "DefaultGateway", - "host": "192.168.0.254", + "host": "192.168.1.1", "indice": "port_0", "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.003303, + "status": 0.006756, "timeout": 3}] Get a specific field:: - # curl http://localhost:61208/api/3/ports/host - {"host": ["192.168.0.254"]} + # curl http://localhost:61208/api/4/ports/host + {"host": ["192.168.1.1"]} Get a specific item when field matches the given value:: - # curl http://localhost:61208/api/3/ports/host/192.168.0.254 - {"192.168.0.254": [{"description": "DefaultGateway", - "host": "192.168.0.254", - "indice": "port_0", - "port": 0, - "refresh": 30, - "rtt_warning": None, - "status": 0.003303, - "timeout": 3}]} + # curl http://localhost:61208/api/4/ports/host/192.168.1.1 + {"192.168.1.1": [{"description": "DefaultGateway", + "host": "192.168.1.1", + "indice": "port_0", + "port": 0, + "refresh": 30, + "rtt_warning": None, + "status": 0.006756, + "timeout": 3}]} GET processcount ---------------- Get plugin stats:: - # curl http://localhost:61208/api/3/processcount - {"pid_max": 0, "running": 1, "sleeping": 358, "thread": 2123, "total": 424} + # curl http://localhost:61208/api/4/processcount + {"pid_max": 0, "running": 1, "sleeping": 325, "thread": 1793, "total": 390} Get a specific field:: - # curl http://localhost:61208/api/3/processcount/total - {"total": 424} + # curl http://localhost:61208/api/4/processcount/total + {"total": 390} GET psutilversion ----------------- Get plugin stats:: - # curl http://localhost:61208/api/3/psutilversion - [5, 9, 5] + # curl http://localhost:61208/api/4/psutilversion + "5.9.6" GET quicklook ------------- Get plugin stats:: - # curl http://localhost:61208/api/3/quicklook - {"cpu": 32.2, - "cpu_hz": 3000000000.0, - "cpu_hz_current": 2628401500.0, + # curl http://localhost:61208/api/4/quicklook + {"cpu": 26.2, + "cpu_hz": 2025000000.0, + "cpu_hz_current": 1973989250.0, "cpu_name": "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz", - "mem": 78.3, + "mem": 80.7, "percpu": [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 11.0, + "idle": 97.1, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 4.0, - "total": 89.0, - "user": 15.0}, + "system": 1.4, + "total": 2.9, + "user": 1.4}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 19.0, - "iowait": 1.0, + "idle": 96.4, + "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 1.0, - "total": 81.0, - "user": 8.0}, + "system": 1.4, + "total": 3.6, + "user": 2.2}, {"cpu_number": 2, "guest": 0.0, "guest_nice": 0.0, - "idle": 24.0, - "iowait": 1.0, + "idle": 34.0, + "iowait": 0.7, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 1.0, - "total": 76.0, - "user": 4.0}, + "system": 2.1, + "total": 66.0, + "user": 63.1}, {"cpu_number": 3, "guest": 0.0, "guest_nice": 0.0, - "idle": 27.0, + "idle": 67.4, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 2.0, - "total": 73.0, - "user": 2.0}], - "swap": 55.4} + "system": 2.9, + "total": 32.6, + "user": 29.7}], + "swap": 39.2} Get a specific field:: - # curl http://localhost:61208/api/3/quicklook/cpu - {"cpu": 32.2} + # curl http://localhost:61208/api/4/quicklook/cpu + {"cpu": 26.2} GET sensors ----------- Get plugin stats:: - # curl http://localhost:61208/api/3/sensors + # curl http://localhost:61208/api/4/sensors [{"critical": 105, "key": "label", "label": "acpitz 0", @@ -706,7 +750,7 @@ Get plugin stats:: Get a specific field:: - # curl http://localhost:61208/api/3/sensors/label + # curl http://localhost:61208/api/4/sensors/label {"label": ["acpitz 0", "acpitz 1", "Package id 0", @@ -719,7 +763,7 @@ Get a specific field:: Get a specific item when field matches the given value:: - # curl http://localhost:61208/api/3/sensors/label/acpitz 0 + # curl http://localhost:61208/api/4/sensors/label/acpitz 0 {"acpitz 0": [{"critical": 105, "key": "label", "label": "acpitz 0", @@ -733,17 +777,17 @@ GET system Get plugin stats:: - # curl http://localhost:61208/api/3/system + # curl http://localhost:61208/api/4/system {"hostname": "XPS13-9333", "hr_name": "Ubuntu 22.04 64bit", "linux_distro": "Ubuntu 22.04", "os_name": "Linux", - "os_version": "5.15.0-78-generic", + "os_version": "5.15.0-88-generic", "platform": "64bit"} Get a specific field:: - # curl http://localhost:61208/api/3/system/os_name + # curl http://localhost:61208/api/4/system/os_name {"os_name": "Linux"} GET uptime @@ -751,15 +795,23 @@ GET uptime Get plugin stats:: - # curl http://localhost:61208/api/3/uptime - "61 days, 22:57:43" + # curl http://localhost:61208/api/4/uptime + "21 days, 5:35:08" + +GET version +----------- + +Get plugin stats:: + + # curl http://localhost:61208/api/4/version + "4.0.0_beta01" GET all stats ------------- Get all Glances stats:: - # curl http://localhost:61208/api/3/all + # curl http://localhost:61208/api/4/all Return a very big dictionary (avoid using this request, performances will be poor)... GET top n items of a specific plugin @@ -767,52 +819,76 @@ GET top n items of a specific plugin Get top 2 processes of the processlist plugin:: - # curl http://localhost:61208/api/3/processlist/top/2 - [{"cmdline": ["/snap/firefox/2908/usr/lib/firefox/firefox"], - "cpu_percent": 0.0, - "cpu_times": pcputimes(user=11580.71, system=3577.12, children_user=9078.74, children_system=1390.45, iowait=0.0), - "gids": pgids(real=1000, effective=1000, saved=1000), - "io_counters": [13420777472, 17349627904, 0, 0, 0], - "key": "pid", - "memory_info": pmem(rss=533090304, vms=22503579648, shared=103047168, text=643072, lib=0, data=1594458112, dirty=0), - "memory_percent": 6.813873288730872, - "name": "firefox", - "nice": 0, - "num_threads": 180, - "pid": 6490, - "status": "S", - "time_since_update": 1, - "username": "nicolargo"}, - {"cmdline": ["/snap/firefox/2908/usr/lib/firefox/firefox", + # curl http://localhost:61208/api/4/processlist/top/2 + [{"cmdline": ["/snap/firefox/3206/usr/lib/firefox/firefox", "-contentproc", "-childID", - "1", + "3", "-isForBrowser", "-prefsLen", - "33570", + "41102", "-prefMapSize", - "245480", + "234514", "-jsInitLen", - "240908", + "234236", "-parentBuildID", - "20230710222611", + "20230928054334", + "-greomni", + "/snap/firefox/3206/usr/lib/firefox/omni.ja", + "-appomni", + "/snap/firefox/3206/usr/lib/firefox/browser/omni.ja", "-appDir", - "/snap/firefox/2908/usr/lib/firefox/browser", - "{0ad13ab1-9130-48f6-a388-06a571221c5c}", - "6490", + "/snap/firefox/3206/usr/lib/firefox/browser", + "{912ef42c-455b-4ef1-acbb-dbd1bb6d42d4}", + "7195", "true", "tab"], "cpu_percent": 0.0, - "cpu_times": pcputimes(user=1792.99, system=226.55, children_user=0.0, children_system=0.0, iowait=0.0), - "gids": pgids(real=1000, effective=1000, saved=1000), - "io_counters": [2603199488, 0, 0, 0, 0], + "cpu_times": {"children_system": 0.0, + "children_user": 0.0, + "iowait": 0.0, + "system": 299.32, + "user": 3357.83}, + "gids": {"effective": 1000, "real": 1000, "saved": 1000}, + "io_counters": [405289984, 0, 0, 0, 0], "key": "pid", - "memory_info": pmem(rss=501956608, vms=4198289408, shared=37511168, text=643072, lib=0, data=1584558080, dirty=0), - "memory_percent": 6.415927466114921, + "memory_info": {"data": 1191260160, + "dirty": 0, + "lib": 0, + "rss": 482578432, + "shared": 50585600, + "text": 643072, + "vms": 3809882112}, + "memory_percent": 6.16825169955839, "name": "WebExtensions", "nice": 0, "num_threads": 20, - "pid": 6903, + "pid": 7586, + "status": "S", + "time_since_update": 1, + "username": "nicolargo"}, + {"cmdline": ["/snap/firefox/3206/usr/lib/firefox/firefox"], + "cpu_percent": 0.0, + "cpu_times": {"children_system": 965.5, + "children_user": 6851.05, + "iowait": 0.0, + "system": 2456.28, + "user": 8476.01}, + "gids": {"effective": 1000, "real": 1000, "saved": 1000}, + "io_counters": [6493832192, 9773744128, 0, 0, 0], + "key": "pid", + "memory_info": {"data": 1300467712, + "dirty": 0, + "lib": 0, + "rss": 474091520, + "shared": 117129216, + "text": 643072, + "vms": 13574438912}, + "memory_percent": 6.0597731478936465, + "name": "firefox", + "nice": 0, + "num_threads": 147, + "pid": 7195, "status": "S", "time_since_update": 1, "username": "nicolargo"}] @@ -824,42 +900,42 @@ GET stats history History of a plugin:: - # curl http://localhost:61208/api/3/cpu/history - {"system": [["2023-10-07T10:23:55.322302", 7.6], - ["2023-10-07T10:23:56.352046", 2.5], - ["2023-10-07T10:23:57.502402", 2.5]], - "user": [["2023-10-07T10:23:55.322289", 23.7], - ["2023-10-07T10:23:56.352036", 9.9], - ["2023-10-07T10:23:57.502391", 9.9]]} + # curl http://localhost:61208/api/4/cpu/history + {"system": [["2023-12-16T14:33:03.105389", 2.0], + ["2023-12-16T14:33:04.129951", 1.8], + ["2023-12-16T14:33:05.327322", 1.8]], + "user": [["2023-12-16T14:33:03.105374", 24.2], + ["2023-12-16T14:33:04.129938", 10.0], + ["2023-12-16T14:33:05.327306", 10.0]]} Limit history to last 2 values:: - # curl http://localhost:61208/api/3/cpu/history/2 - {"system": [["2023-10-07T10:23:56.352046", 2.5], - ["2023-10-07T10:23:57.502402", 2.5]], - "user": [["2023-10-07T10:23:56.352036", 9.9], - ["2023-10-07T10:23:57.502391", 9.9]]} + # curl http://localhost:61208/api/4/cpu/history/2 + {"system": [["2023-12-16T14:33:04.129951", 1.8], + ["2023-12-16T14:33:05.327322", 1.8]], + "user": [["2023-12-16T14:33:04.129938", 10.0], + ["2023-12-16T14:33:05.327306", 10.0]]} History for a specific field:: - # curl http://localhost:61208/api/3/cpu/system/history - {"system": [["2023-10-07T10:23:53.734251", 7.6], - ["2023-10-07T10:23:55.322302", 7.6], - ["2023-10-07T10:23:56.352046", 2.5], - ["2023-10-07T10:23:57.502402", 2.5]]} + # curl http://localhost:61208/api/4/cpu/system/history + {"system": [["2023-12-16T14:33:01.240422", 2.0], + ["2023-12-16T14:33:03.105389", 2.0], + ["2023-12-16T14:33:04.129951", 1.8], + ["2023-12-16T14:33:05.327322", 1.8]]} Limit history for a specific field to last 2 values:: - # curl http://localhost:61208/api/3/cpu/system/history - {"system": [["2023-10-07T10:23:56.352046", 2.5], - ["2023-10-07T10:23:57.502402", 2.5]]} + # curl http://localhost:61208/api/4/cpu/system/history + {"system": [["2023-12-16T14:33:04.129951", 1.8], + ["2023-12-16T14:33:05.327322", 1.8]]} GET limits (used for thresholds) -------------------------------- All limits/thresholds:: - # curl http://localhost:61208/api/3/all/limits + # curl http://localhost:61208/api/4/all/limits {"alert": {"alert_disable": ["False"], "history_size": 1200 |