From e3ea678f94770d22e06a6dea9fa87bc584bb31b3 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Fri, 22 Dec 2023 18:50:56 +0100 Subject: Update doc --- docs/api.rst | 254 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 130 insertions(+), 124 deletions(-) (limited to 'docs/api.rst') diff --git a/docs/api.rst b/docs/api.rst index 6f34e745..55292324 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -109,14 +109,14 @@ GET alert Get plugin stats:: # curl http://localhost:61208/api/4/alert - [[1703266291.0, + [[1703267439.0, -1, "WARNING", "MEM", - 79.30944396889095, - 79.30944396889095, - 79.30944396889095, - 79.30944396889095, + 79.6369214499059, + 79.6369214499059, + 79.6369214499059, + 79.6369214499059, 1, [], "", @@ -136,7 +136,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.34033823013305664}, + "timer": 0.3104400634765625}, {"count": 0, "countmax": 20.0, "countmin": None, @@ -145,7 +145,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.34007930755615234}] + "timer": 0.31027841567993164}] Fields descriptions: @@ -173,7 +173,7 @@ Get a specific item when field matches the given value:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.34033823013305664}]} + "timer": 0.3104400634765625}]} GET connections --------------- @@ -207,8 +207,8 @@ Get plugin stats:: # curl http://localhost:61208/api/4/containers [{"command": "top", - "cpu": {"total": 1.2118984034342537e-06}, - "cpu_percent": 1.2118984034342537e-06, + "cpu": {"total": 1.2239390896538464e-06}, + "cpu_percent": 1.2239390896538464e-06, "created": "2023-12-09T10:45:34.339489876+01:00", "engine": "podman", "id": "481d6ffb7eef284d062628cf350bdd9ce0a803db8a2a505d75565ed24322b714", @@ -228,8 +228,8 @@ Get plugin stats:: "status": "running", "uptime": "1 weeks"}, {"command": "", - "cpu": {"total": 3.3083493909342666e-10}, - "cpu_percent": 3.3083493909342666e-10, + "cpu": {"total": 3.308347161188483e-10}, + "cpu_percent": 3.308347161188483e-10, "created": "2022-10-22T14:23:03.120912374+02:00", "engine": "podman", "id": "9491515251edcd5bb5dc17205d7ee573c0be96fe0b08b0a12a7e2cea874565ea", @@ -277,8 +277,8 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/containers/name/sad_darwin {"sad_darwin": [{"command": "top", - "cpu": {"total": 1.2118984034342537e-06}, - "cpu_percent": 1.2118984034342537e-06, + "cpu": {"total": 1.2239390896538464e-06}, + "cpu_percent": 1.2239390896538464e-06, "created": "2023-12-09T10:45:34.339489876+01:00", "engine": "podman", "id": "481d6ffb7eef284d062628cf350bdd9ce0a803db8a2a505d75565ed24322b714", @@ -326,7 +326,7 @@ Get plugin stats:: "ctx_switches": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 56.4, + "idle": 67.2, "interrupts": 0, "iowait": 0.5, "irq": 0.0, @@ -335,10 +335,10 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "syscalls": 0, - "system": 13.7, + "system": 3.1, "time_since_update": 1, - "total": 43.1, - "user": 29.4} + "total": 32.5, + "user": 29.2} Fields descriptions: @@ -361,7 +361,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/cpu/total - {"total": 43.1} + {"total": 32.5} GET diskio ---------- @@ -418,13 +418,13 @@ Get plugin stats:: # curl http://localhost:61208/api/4/fs [{"alias": "Root", "device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 25942876160, + "free": 25932427264, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", "percent": 88.8, "size": 243334156288, - "used": 205003825152}, + "used": 205014274048}, {"device_name": "zsfpool", "free": 31195136, "fs_type": "zfs", @@ -454,13 +454,13 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/fs/mnt_point// {"/": [{"alias": "Root", "device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 25942876160, + "free": 25932427264, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", "percent": 88.8, "size": 243334156288, - "used": 205003825152}]} + "used": 205014274048}]} GET ip ------ @@ -496,9 +496,9 @@ Get plugin stats:: # curl http://localhost:61208/api/4/load {"cpucore": 4, - "min1": 2.26123046875, - "min15": 2.50341796875, - "min5": 2.59912109375} + "min1": 2.44921875, + "min15": 1.44970703125, + "min5": 1.49560546875} Fields descriptions: @@ -510,7 +510,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/load/min1 - {"min1": 2.26123046875} + {"min1": 2.44921875} GET mem ------- @@ -518,16 +518,16 @@ GET mem Get plugin stats:: # curl http://localhost:61208/api/4/mem - {"active": 3336941568, - "available": 1618743296, - "buffers": 94175232, - "cached": 1807302656, - "free": 1618743296, - "inactive": 3029139456, - "percent": 79.3, - "shared": 499687424, + {"active": 3288240128, + "available": 1593122816, + "buffers": 103399424, + "cached": 1911443456, + "free": 1593122816, + "inactive": 2737258496, + "percent": 79.6, + "shared": 553684992, "total": 7823585280, - "used": 6204841984} + "used": 6230462464} Fields descriptions: @@ -554,13 +554,13 @@ GET memswap Get plugin stats:: # curl http://localhost:61208/api/4/memswap - {"free": 4660985856, + {"free": 4665704448, "percent": 42.3, - "sin": 8542650368, + "sin": 8550678528, "sout": 14097289216, "time_since_update": 1, "total": 8082419712, - "used": 3421433856} + "used": 3416715264} Fields descriptions: @@ -584,9 +584,9 @@ Get plugin stats:: # curl http://localhost:61208/api/4/network [{"alias": None, - "cumulative_cx": 1914532754, - "cumulative_rx": 957266377, - "cumulative_tx": 957266377, + "cumulative_cx": 1916622530, + "cumulative_rx": 958311265, + "cumulative_tx": 958311265, "cx": 0, "interface_name": "lo", "is_up": True, @@ -596,14 +596,14 @@ Get plugin stats:: "time_since_update": 1, "tx": 0}, {"alias": "WIFI", - "cumulative_cx": 6798864423, - "cumulative_rx": 6350558377, - "cumulative_tx": 448306046, - "cx": 126, + "cumulative_cx": 6803793098, + "cumulative_rx": 6353416422, + "cumulative_tx": 450376676, + "cx": 224, "interface_name": "wlp2s0", "is_up": True, "key": "interface_name", - "rx": 0, + "rx": 98, "speed": 0, "time_since_update": 1, "tx": 126}] @@ -637,9 +637,9 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/network/interface_name/lo {"lo": [{"alias": None, - "cumulative_cx": 1914532754, - "cumulative_rx": 957266377, - "cumulative_tx": 957266377, + "cumulative_cx": 1916622530, + "cumulative_rx": 958311265, + "cumulative_tx": 958311265, "cx": 0, "interface_name": "lo", "is_up": True, @@ -655,7 +655,7 @@ GET now Get plugin stats:: # curl http://localhost:61208/api/4/now - "2023-12-22 18:31:31 CET" + "2023-12-22 18:50:39 CET" GET percpu ---------- @@ -666,29 +666,29 @@ Get plugin stats:: [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 36.0, + "idle": 39.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, - "softirq": 0.0, + "softirq": 1.0, "steal": 0.0, - "system": 8.0, - "total": 64.0, - "user": 6.0}, + "system": 1.0, + "total": 61.0, + "user": 8.0}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 33.0, + "idle": 10.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, - "softirq": 1.0, + "softirq": 0.0, "steal": 0.0, - "system": 14.0, - "total": 67.0, - "user": 3.0}] + "system": 3.0, + "total": 90.0, + "user": 35.0}] Fields descriptions: @@ -722,7 +722,7 @@ Get plugin stats:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.006345, + "status": 0.006758, "timeout": 3}] Fields descriptions: @@ -750,7 +750,7 @@ Get a specific item when field matches the given value:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.006345, + "status": 0.006758, "timeout": 3}]} GET processcount @@ -759,7 +759,7 @@ GET processcount Get plugin stats:: # curl http://localhost:61208/api/4/processcount - {"pid_max": 0, "running": 1, "sleeping": 316, "thread": 1568, "total": 387} + {"pid_max": 0, "running": 1, "sleeping": 313, "thread": 1503, "total": 378} Fields descriptions: @@ -772,7 +772,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/processcount/total - {"total": 387} + {"total": 378} GET psutilversion ----------------- @@ -788,50 +788,50 @@ GET quicklook Get plugin stats:: # curl http://localhost:61208/api/4/quicklook - {"cpu": 43.1, + {"cpu": 32.5, "cpu_hz": 2025000000.0, - "cpu_hz_current": 1747194750.0, + "cpu_hz_current": 1771797500.0000002, "cpu_name": "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz", - "mem": 79.3, + "mem": 79.6, "percpu": [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 36.0, + "idle": 39.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, - "softirq": 0.0, + "softirq": 1.0, "steal": 0.0, - "system": 8.0, - "total": 64.0, - "user": 6.0}, + "system": 1.0, + "total": 61.0, + "user": 8.0}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 33.0, + "idle": 10.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, - "softirq": 1.0, + "softirq": 0.0, "steal": 0.0, - "system": 14.0, - "total": 67.0, - "user": 3.0}, + "system": 3.0, + "total": 90.0, + "user": 35.0}, {"cpu_number": 2, "guest": 0.0, "guest_nice": 0.0, - "idle": 3.0, - "iowait": 1.0, + "idle": 39.0, + "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 7.0, - "total": 97.0, - "user": 42.0}, + "system": 1.0, + "total": 61.0, + "user": 8.0}, {"cpu_number": 3, "guest": 0.0, "guest_nice": 0.0, @@ -842,9 +842,9 @@ Get plugin stats:: "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 1.0, + "system": 0.0, "total": 57.0, - "user": 9.0}], + "user": 6.0}], "swap": 42.3} Fields descriptions: @@ -859,7 +859,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/quicklook/cpu - {"cpu": 43.1} + {"cpu": 32.5} GET sensors ----------- @@ -948,7 +948,7 @@ GET uptime Get plugin stats:: # curl http://localhost:61208/api/4/uptime - "27 days, 9:33:37" + "27 days, 9:52:45" GET version ----------- @@ -969,7 +969,7 @@ Get all Glances stats:: GET top n items of a specific plugin ------------------------------------ -Get top 2 processes of the processlist plugin:: +Get top 2 processes of the processlist plugin: # curl http://localhost:61208/api/4/processlist/top/2 [{"cmdline": ["/snap/firefox/3206/usr/lib/firefox/firefox", @@ -999,22 +999,22 @@ Get top 2 processes of the processlist plugin:: "cpu_times": {"children_system": 0.0, "children_user": 0.0, "iowait": 0.0, - "system": 388.27, - "user": 4330.13}, + "system": 390.03, + "user": 4349.54}, "gids": {"effective": 1000, "real": 1000, "saved": 1000}, - "io_counters": [516647936, 0, 0, 0, 0], + "io_counters": [517786624, 0, 0, 0, 0], "key": "pid", - "memory_info": {"data": 1560563712, + "memory_info": {"data": 1444909056, "dirty": 0, "lib": 0, - "rss": 786944000, - "shared": 53026816, + "rss": 641499136, + "shared": 54018048, "text": 643072, - "vms": 4198535168}, - "memory_percent": 10.05861087769724, + "vms": 4070506496}, + "memory_percent": 8.199554463091378, "name": "WebExtensions", "nice": 0, - "num_threads": 20, + "num_threads": 25, "pid": 7586, "status": "S", "time_since_update": 1, @@ -1029,19 +1029,19 @@ Get top 2 processes of the processlist plugin:: "cpu_times": {"children_system": 0.41, "children_user": 4.19, "iowait": 0.0, - "system": 237.34, - "user": 4002.03}, + "system": 239.99, + "user": 4053.31}, "gids": {"effective": 1000, "real": 1000, "saved": 1000}, - "io_counters": [349560832, 1896448, 0, 0, 0], + "io_counters": [352980992, 1896448, 0, 0, 0], "key": "pid", - "memory_info": {"data": 875028480, + "memory_info": {"data": 868229120, "dirty": 0, "lib": 0, - "rss": 489472000, - "shared": 22188032, + "rss": 490070016, + "shared": 22233088, "text": 120565760, "vms": 1207768694784}, - "memory_percent": 6.256364345529317, + "memory_percent": 6.264008104478667, "name": "code", "nice": 0, "num_threads": 13, @@ -1052,52 +1052,58 @@ Get top 2 processes of the processlist plugin:: Note: Only work for plugin with a list of items -GET item description of a specific plugin ------------------------------------------ +GET item description +-------------------- +Get item description (human readable) for a specific plugin/item: # curl http://localhost:61208/api/4/diskio/read_bytes/description "Number of bytes read since last request." -GET item unit of a specific plugin ----------------------------------- +Note: the description is defined in the fields_description variable of the plugin. + +GET item unit +------------- +Get item unit for a specific plugin/item: # curl http://localhost:61208/api/4/diskio/read_bytes/unit "byte" +Note: the description is defined in the fields_description variable of the plugin. + GET stats history ----------------- History of a plugin:: # curl http://localhost:61208/api/4/cpu/history - {"system": [["2023-12-22T18:31:33.164741", 13.7], - ["2023-12-22T18:31:34.185713", 2.0], - ["2023-12-22T18:31:35.412977", 2.0]], - "user": [["2023-12-22T18:31:33.164727", 29.4], - ["2023-12-22T18:31:34.185705", 14.0], - ["2023-12-22T18:31:35.412964", 14.0]]} + {"system": [["2023-12-22T18:50:41.125038", 3.1], + ["2023-12-22T18:50:42.144977", 1.8], + ["2023-12-22T18:50:43.359268", 1.8]], + "user": [["2023-12-22T18:50:41.125027", 29.2], + ["2023-12-22T18:50:42.144968", 12.9], + ["2023-12-22T18:50:43.359254", 12.9]]} Limit history to last 2 values:: # curl http://localhost:61208/api/4/cpu/history/2 - {"system": [["2023-12-22T18:31:34.185713", 2.0], - ["2023-12-22T18:31:35.412977", 2.0]], - "user": [["2023-12-22T18:31:34.185705", 14.0], - ["2023-12-22T18:31:35.412964", 14.0]]} + {"system": [["2023-12-22T18:50:42.144977", 1.8], + ["2023-12-22T18:50:43.359268", 1.8]], + "user": [["2023-12-22T18:50:42.144968", 12.9], + ["2023-12-22T18:50:43.359254", 12.9]]} History for a specific field:: # curl http://localhost:61208/api/4/cpu/system/history - {"system": [["2023-12-22T18:31:31.274678", 13.7], - ["2023-12-22T18:31:33.164741", 13.7], - ["2023-12-22T18:31:34.185713", 2.0], - ["2023-12-22T18:31:35.412977", 2.0]]} + {"system": [["2023-12-22T18:50:39.219308", 3.1], + ["2023-12-22T18:50:41.125038", 3.1], + ["2023-12-22T18:50:42.144977", 1.8], + ["2023-12-22T18:50:43.359268", 1.8]]} Limit history for a specific field to last 2 values:: # curl http://localhost:61208/api/4/cpu/system/history - {"system": [["2023-12-22T18:31:34.185713", 2.0], - ["2023-12-22T18:31:35.412977", 2.0]]} + {"system": [["2023-12-22T18:50:42.144977", 1.8], + ["2023-12-22T18:50:43.359268", 1.8]]} GET limits (used for thresholds) -------------------------------- -- cgit v1.2.3