From c0c66ea6530a279bb6e0472ca87ff3a1db6463a9 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Tue, 24 May 2022 12:23:52 +0200 Subject: [PATCH 01/17] version 3.2.6.1 --- glances/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glances/__init__.py b/glances/__init__.py index 54fa4b31..baf54cd1 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -29,7 +29,7 @@ import sys # Global name # Version should start and end with a numerical char # See https://packaging.python.org/specifications/core-metadata/#version -__version__ = '3.2.6' +__version__ = '3.2.6.1' __author__ = 'Nicolas Hennion ' __license__ = 'LGPLv3' From cd600f6f486f1812778f53668da86c203c12646b Mon Sep 17 00:00:00 2001 From: nicolargo Date: Wed, 25 May 2022 16:53:56 +0200 Subject: [PATCH 02/17] Remove a log message --- glances/plugins/glances_diskio.py | 1 - 1 file changed, 1 deletion(-) diff --git a/glances/plugins/glances_diskio.py b/glances/plugins/glances_diskio.py index 4fff8a51..40cfe99d 100644 --- a/glances/plugins/glances_diskio.py +++ b/glances/plugins/glances_diskio.py @@ -99,7 +99,6 @@ class Plugin(GlancesPlugin): continue # Shall we display the stats ? - logger.info("diskio: %s => %s", disk, self.is_display(disk)) if not self.is_display(disk): continue From c2a37fc72cd8223562f2e56680d60cbc0312f5ea Mon Sep 17 00:00:00 2001 From: nicolargo Date: Wed, 25 May 2022 16:56:39 +0200 Subject: [PATCH 03/17] version 3.6.2.2 --- README.rst | 4 ++-- glances/__init__.py | 2 +- glances/plugins/glances_diskio.py | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 453f6224..d09f1bc2 100644 --- a/README.rst +++ b/README.rst @@ -59,7 +59,7 @@ Social networks .. image:: https://raw.githubusercontent.com/nicolargo/glances/develop/docs/_static/twitter-icon.png :target: https://twitter.com/nicolargo - + .. image:: https://raw.githubusercontent.com/nicolargo/glances/develop/docs/_static/reddit.png :target: https://www.reddit.com/r/glances/ @@ -211,7 +211,7 @@ Available versions on the Docker Hub repository: - *nicolargo/glances:latest-full* for a full Debian Glances image version with all dependencies - *nicolargo/glances:alpine-latest-full* for a full Alpine Glances image version with all dependencies -You can also specify a version by replacing latest by 3.2.3 (for example). +You can also specify a version by replacing latest by 3.6.2.2 (for example). Run last version of Glances container in *console mode*: diff --git a/glances/__init__.py b/glances/__init__.py index baf54cd1..e550588c 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -29,7 +29,7 @@ import sys # Global name # Version should start and end with a numerical char # See https://packaging.python.org/specifications/core-metadata/#version -__version__ = '3.2.6.1' +__version__ = '3.2.6.2' __author__ = 'Nicolas Hennion ' __license__ = 'LGPLv3' diff --git a/glances/plugins/glances_diskio.py b/glances/plugins/glances_diskio.py index 4fff8a51..40cfe99d 100644 --- a/glances/plugins/glances_diskio.py +++ b/glances/plugins/glances_diskio.py @@ -99,7 +99,6 @@ class Plugin(GlancesPlugin): continue # Shall we display the stats ? - logger.info("diskio: %s => %s", disk, self.is_display(disk)) if not self.is_display(disk): continue From 472b1f8296600efa3954f2badcd2428f0366c194 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Wed, 25 May 2022 22:40:38 +0200 Subject: [PATCH 04/17] Update the documentation conerning the Docker Gances conf file --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index d09f1bc2..241ea923 100644 --- a/README.rst +++ b/README.rst @@ -225,15 +225,15 @@ create your own Dockerfile: .. code-block:: console FROM nicolargo/glances:latest - COPY glances.conf /glances/conf/glances.conf - CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT + COPY glances.conf /etc/glances.conf + CMD python -m glances -C /etc/glances.conf $GLANCES_OPT Alternatively, you can specify something along the same lines with docker run options: .. code-block:: console - docker run -v `pwd`/glances.conf:/glances/conf/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -it nicolargo/glances:latest-full + docker run -v `pwd`/glances.conf:/etc/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -it nicolargo/glances:latest-full Where \`pwd\`/glances.conf is a local directory containing your glances.conf file. From 8012fe5546b7966f54b19bb270278a5200c071b5 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Wed, 25 May 2022 22:40:38 +0200 Subject: [PATCH 05/17] Update the documentation conerning the Docker Gances conf file --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 453f6224..7fa2fcc8 100644 --- a/README.rst +++ b/README.rst @@ -225,15 +225,15 @@ create your own Dockerfile: .. code-block:: console FROM nicolargo/glances:latest - COPY glances.conf /glances/conf/glances.conf - CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT + COPY glances.conf /etc/glances.conf + CMD python -m glances -C /etc/glances.conf $GLANCES_OPT Alternatively, you can specify something along the same lines with docker run options: .. code-block:: console - docker run -v `pwd`/glances.conf:/glances/conf/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -it nicolargo/glances:latest-full + docker run -v `pwd`/glances.conf:/etc/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -it nicolargo/glances:latest-full Where \`pwd\`/glances.conf is a local directory containing your glances.conf file. From 3d27c915561c2a3e676d0bec54164ff20c85a7b1 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Wed, 25 May 2022 22:48:18 +0200 Subject: [PATCH 06/17] Glances version 3.2.6.3 --- README.rst | 2 +- docs/api.rst | 539 +++++++++++++++++++++++--------------------- docs/man/glances.1 | 2 +- glances/__init__.py | 2 +- 4 files changed, 288 insertions(+), 257 deletions(-) diff --git a/README.rst b/README.rst index 241ea923..ca552967 100644 --- a/README.rst +++ b/README.rst @@ -211,7 +211,7 @@ Available versions on the Docker Hub repository: - *nicolargo/glances:latest-full* for a full Debian Glances image version with all dependencies - *nicolargo/glances:alpine-latest-full* for a full Alpine Glances image version with all dependencies -You can also specify a version by replacing latest by 3.6.2.2 (for example). +You can also specify a version by replacing latest by 3.2.6.3 (for example). Run last version of Glances container in *console mode*: diff --git a/docs/api.rst b/docs/api.rst index 3f049a27..35aa8a7b 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -60,6 +60,25 @@ Get the plugins list:: "uptime", "wifi"] +GET alert +--------- + +Get plugin stats:: + + # curl http://localhost:61208/api/3/alert + [[1653511582.0, + -1, + "WARNING", + "MEM", + 81.37629268155027, + 81.37629268155027, + 81.37629268155027, + 81.37629268155027, + 1, + [], + "", + "memory_percent"]] + GET amps -------- @@ -74,7 +93,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.752385139465332}, + "timer": 1.2215237617492676}, {"count": 0, "countmax": 20.0, "countmin": None, @@ -83,7 +102,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.7522008419036865}] + "timer": 1.2214140892028809}] Get a specific field:: @@ -101,7 +120,7 @@ Get a specific item when field matchs the given value:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.752385139465332}]} + "timer": 1.2215237617492676}]} GET core -------- @@ -131,19 +150,19 @@ Get plugin stats:: "ctx_switches": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 62.1, + "idle": 68.6, "interrupts": 0, - "iowait": 0.0, + "iowait": 0.1, "irq": 0.0, "nice": 0.0, "soft_interrupts": 0, "softirq": 0.0, "steal": 0.0, "syscalls": 0, - "system": 7.0, + "system": 4.3, "time_since_update": 1, - "total": 39.6, - "user": 30.8} + "total": 35.6, + "user": 27.0} Fields descriptions: @@ -165,7 +184,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/cpu/total - {"total": 39.6} + {"total": 35.6} GET diskio ---------- @@ -220,7 +239,7 @@ Get plugin stats:: "io_r": None, "io_w": None, "key": "name", - "memory_usage": 33189888, + "memory_usage": 35647488, "name": "telegraf", "network_rx": None, "network_tx": None}, @@ -246,13 +265,13 @@ Get plugin stats:: # curl http://localhost:61208/api/3/fs [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 99621335040, + "free": 99862933504, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 56.9, + "percent": 56.8, "size": 243396149248, - "used": 131387359232}] + "used": 131145760768}] Get a specific field:: @@ -263,13 +282,13 @@ Get a specific item when field matchs the given value:: # curl http://localhost:61208/api/3/fs/mnt_point// {"/": [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 99621335040, + "free": 99862933504, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 56.9, + "percent": 56.8, "size": 243396149248, - "used": 131387359232}]} + "used": 131145760768}]} GET ip ------ @@ -277,16 +296,16 @@ GET ip Get plugin stats:: # curl http://localhost:61208/api/3/ip - {"address": "192.168.0.49", + {"address": "192.168.0.33", "gateway": "192.168.0.254", "mask": "255.255.255.0", "mask_cidr": 24, - "public_address": "82.66.169.82"} + "public_address": "91.166.228.228"} Get a specific field:: # curl http://localhost:61208/api/3/ip/address - {"address": "192.168.0.49"} + {"address": "192.168.0.33"} GET load -------- @@ -294,10 +313,7 @@ GET load Get plugin stats:: # curl http://localhost:61208/api/3/load - {"cpucore": 4, - "min1": 1.09228515625, - "min15": 0.95849609375, - "min5": 1.00048828125} + {"cpucore": 4, "min1": 1.7607421875, "min15": 0.787109375, "min5": 1.0986328125} Fields descriptions: @@ -309,7 +325,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/load/min1 - {"min1": 1.09228515625} + {"min1": 1.7607421875} GET mem ------- @@ -317,16 +333,16 @@ GET mem Get plugin stats:: # curl http://localhost:61208/api/3/mem - {"active": 3533307904, - "available": 3111428096, - "buffers": 323248128, - "cached": 3250700288, - "free": 3111428096, - "inactive": 2721816576, - "percent": 60.3, - "shared": 543281152, + {"active": 2994515968, + "available": 1459716096, + "buffers": 120791040, + "cached": 2113867776, + "free": 1459716096, + "inactive": 3645423616, + "percent": 81.4, + "shared": 646406144, "total": 7837945856, - "used": 4726517760} + "used": 6378229760} Fields descriptions: @@ -353,13 +369,13 @@ GET memswap Get plugin stats:: # curl http://localhost:61208/api/3/memswap - {"free": 6209282048, - "percent": 23.2, - "sin": 732037120, - "sout": 2645266432, + {"free": 6304215040, + "percent": 22.0, + "sin": 1377947648, + "sout": 3402825728, "time_since_update": 1, "total": 8082419712, - "used": 1873137664} + "used": 1778204672} Fields descriptions: @@ -383,29 +399,29 @@ Get plugin stats:: # curl http://localhost:61208/api/3/network [{"alias": None, - "cumulative_cx": 162243466, - "cumulative_rx": 81121733, - "cumulative_tx": 81121733, - "cx": 2556, + "cumulative_cx": 473925792, + "cumulative_rx": 236962896, + "cumulative_tx": 236962896, + "cx": 4156, "interface_name": "lo", "is_up": True, "key": "interface_name", - "rx": 1278, + "rx": 2078, "speed": 0, "time_since_update": 1, - "tx": 1278}, + "tx": 2078}, {"alias": None, - "cumulative_cx": 4744271709, - "cumulative_rx": 4464070610, - "cumulative_tx": 280201099, - "cx": 26523, + "cumulative_cx": 5365392428, + "cumulative_rx": 5016373584, + "cumulative_tx": 349018844, + "cx": 34101, "interface_name": "wlp2s0", "is_up": True, "key": "interface_name", - "rx": 20315, + "rx": 23539, "speed": 0, "time_since_update": 1, - "tx": 6208}] + "tx": 10562}] Fields descriptions: @@ -437,17 +453,17 @@ Get a specific item when field matchs the given value:: # curl http://localhost:61208/api/3/network/interface_name/lo {"lo": [{"alias": None, - "cumulative_cx": 162243466, - "cumulative_rx": 81121733, - "cumulative_tx": 81121733, - "cx": 2556, + "cumulative_cx": 473925792, + "cumulative_rx": 236962896, + "cumulative_tx": 236962896, + "cx": 4156, "interface_name": "lo", "is_up": True, "key": "interface_name", - "rx": 1278, + "rx": 2078, "speed": 0, "time_since_update": 1, - "tx": 1278}]} + "tx": 2078}]} GET now ------- @@ -455,7 +471,7 @@ GET now Get plugin stats:: # curl http://localhost:61208/api/3/now - "2022-05-24 12:02:07 CEST" + "2022-05-25 22:46:22 CEST" GET percpu ---------- @@ -466,29 +482,29 @@ Get plugin stats:: [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 57.0, + "idle": 56.9, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 7.0, - "total": 43.0, - "user": 26.0}, + "system": 4.6, + "total": 43.1, + "user": 38.5}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 68.0, + "idle": 73.8, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 6.0, - "total": 32.0, - "user": 17.0}] + "system": 4.6, + "total": 26.2, + "user": 21.5}] Get a specific field:: @@ -507,7 +523,7 @@ Get plugin stats:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.004532, + "status": 0.011961, "timeout": 3}] Get a specific field:: @@ -524,7 +540,7 @@ Get a specific item when field matchs the given value:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.004532, + "status": 0.011961, "timeout": 3}]} GET processcount @@ -533,12 +549,12 @@ GET processcount Get plugin stats:: # curl http://localhost:61208/api/3/processcount - {"pid_max": 0, "running": 1, "sleeping": 255, "thread": 1394, "total": 320} + {"pid_max": 0, "running": 1, "sleeping": 269, "thread": 1530, "total": 335} Get a specific field:: # curl http://localhost:61208/api/3/processcount/total - {"total": 320} + {"total": 335} GET processlist --------------- @@ -548,15 +564,15 @@ Get plugin stats:: # curl http://localhost:61208/api/3/processlist [{"cmdline": ["/snap/firefox/1300/usr/lib/firefox/firefox"], "cpu_percent": 0.0, - "cpu_times": pcputimes(user=4191.85, system=1588.46, children_user=3119.18, children_system=692.52, iowait=0.0), + "cpu_times": pcputimes(user=7265.13, system=2644.4, children_user=4225.08, children_system=934.33, iowait=0.0), "gids": pgids(real=1000, effective=1000, saved=1000), - "io_counters": [1992798208, 5691990016, 0, 0, 0], + "io_counters": [2597592064, 8660602880, 0, 0, 0], "key": "pid", - "memory_info": pmem(rss=459440128, vms=13888520192, shared=139042816, text=643072, lib=0, data=1830445056, dirty=0), - "memory_percent": 5.861741538419732, + "memory_info": pmem(rss=521797632, vms=14051770368, shared=142577664, text=643072, lib=0, data=1934319616, dirty=0), + "memory_percent": 6.657326314656288, "name": "firefox", "nice": 0, - "num_threads": 153, + "num_threads": 165, "pid": 10259, "ppid": 2922, "status": "S", @@ -581,12 +597,12 @@ Get plugin stats:: "true", "tab"], "cpu_percent": 0.0, - "cpu_times": pcputimes(user=1055.29, system=197.09, children_user=0.0, children_system=0.0, iowait=0.0), + "cpu_times": pcputimes(user=1572.98, system=303.12, children_user=0.0, children_system=0.0, iowait=0.0), "gids": pgids(real=1000, effective=1000, saved=1000), - "io_counters": [122664960, 0, 0, 0, 0], + "io_counters": [157250560, 0, 0, 0, 0], "key": "pid", - "memory_info": pmem(rss=361443328, vms=3296440320, shared=56553472, text=643072, lib=0, data=714555392, dirty=0), - "memory_percent": 4.611454769406358, + "memory_info": pmem(rss=498479104, vms=3363688448, shared=77520896, text=643072, lib=0, data=767954944, dirty=0), + "memory_percent": 6.359818161009762, "name": "WebExtensions", "nice": 0, "num_threads": 20, @@ -601,169 +617,183 @@ Get a specific field:: # curl http://localhost:61208/api/3/processlist/pid {"pid": [10259, 10790, + 271153, + 271200, + 10854, 20979, 10850, - 21025, - 21227, - 10854, 2922, + 21227, + 271409, + 21025, + 240874, 62372, - 186149, + 308697, 10857, + 271083, + 271184, 10814, - 20905, - 21039, - 216634, + 308943, + 309130, + 306581, + 271118, 12436, - 216880, - 216694, - 217080, - 185769, - 52875, - 176018, - 217078, - 2820, - 337, - 20947, - 2033, - 186877, - 138834, + 309195, + 306584, + 309267, + 271247, + 271208, 3251, - 21107, - 211759, + 309448, + 337, + 2820, + 271397, + 52875, + 243846, + 2033, + 234429, + 271140, + 3279, 138954, 11390, + 265539, 138989, - 3161, - 1166, + 138834, + 271089, + 266251, + 2505, 3019, + 271088, + 1302, + 186877, + 2109, + 3161, 186878, 10597, - 3279, - 20965, - 1302, - 21063, - 183662, 2790, - 2109, - 21229, - 3066, - 3347, - 8716, - 2999, - 1133, - 3056, - 3065, + 304566, 3706, - 2867, - 3227, - 183682, - 1601, + 8716, + 20965, + 3347, + 3066, + 1133, + 2999, + 232395, + 3056, + 21229, + 3065, 3206, 8715, + 1601, 1, - 3259, - 2081, - 1150, - 3085, - 2964, - 3381, - 1147, 2990, - 2073, + 2964, + 3259, + 3227, + 3085, + 232398, + 2867, + 1150, 3064, + 2073, + 3381, + 218290, 1313, 2900, + 2081, 1990, - 183686, - 1176, - 2505, - 20916, - 20917, - 989, - 3058, + 20932, 144959, - 3178, + 1147, + 1176, 3077, + 2769, 3062, 2781, - 2769, - 2933, + 3058, + 989, + 3178, + 20917, + 20916, 3004, - 8959, - 3068, - 1271, + 2933, + 271268, 2831, + 3068, + 8959, + 1271, 8941, - 1310, - 1173, - 216822, - 1596, - 2971, - 3084, - 1132, - 3268, 10906, - 2794, - 1115, - 1151, 3034, - 3260, - 3136, - 2800, - 2944, - 3129, - 2798, - 2923, - 3079, - 3232, - 3059, - 1139, - 3075, + 241702, + 1173, + 2794, 12458, + 1310, + 1132, + 2800, + 1115, + 2971, + 2798, + 1596, + 3268, + 1151, + 2960, + 3084, + 3136, + 3260, + 3129, + 3059, + 2923, + 2944, + 3232, + 3079, + 1139, 1171, + 138811, + 3075, 1167, 3074, - 3046, - 2888, - 24865, 2977, + 3046, + 138968, + 2888, 2949, - 1161, - 2960, 3226, + 1161, + 24865, + 138923, 3054, - 381, - 2828, - 2788, + 271091, 2079, + 2828, 990, - 138811, + 2788, 1127, 2868, + 234438, 1156, - 2789, - 138923, - 138968, 2805, + 2789, 2080, 2988, - 2931, + 381, 1123, 1142, - 211922, + 2931, 2508, - 21141, - 1178, 1429, - 135946, - 21209, + 1178, 988, 1130, + 21209, 8757, - 217061, + 266415, + 309432, 997, 1183, + 271104, 996, 1996, 3274, @@ -773,24 +803,23 @@ Get a specific field:: 1116, 138788, 138767, - 2782, 138752, + 306441, 138731, - 217077, 138901, + 309447, 1914, 138774, 138745, + 2782, 138724, 3053, 2012, - 20932, 2020, - 1186, 1997, - 2001, + 1186, 138894, - 20919, + 2001, 2, 3, 4, @@ -900,46 +929,48 @@ Get a specific field:: 2071, 2072, 2822, - 183515, - 210080, - 210187, - 210756, - 210822, - 213305, - 213544, - 214155, - 214203, - 214272, - 214503, - 214504, - 214505, - 214578, - 215944, - 215963, - 216344, - 216693, - 217060]} + 20919, + 20947, + 282038, + 303032, + 303046, + 304473, + 304481, + 304546, + 305737, + 305836, + 305906, + 305964, + 306989, + 307047, + 307166, + 307650, + 308467, + 308919, + 308920, + 308925, + 309347]} Get a specific item when field matchs the given value:: # curl http://localhost:61208/api/3/processlist/pid/10259 {"10259": [{"cmdline": ["/snap/firefox/1300/usr/lib/firefox/firefox"], "cpu_percent": 0.0, - "cpu_times": [4191.85, 1588.46, 3119.18, 692.52, 0.0], + "cpu_times": [7265.13, 2644.4, 4225.08, 934.33, 0.0], "gids": [1000, 1000, 1000], - "io_counters": [1992798208, 5691990016, 0, 0, 0], + "io_counters": [2597592064, 8660602880, 0, 0, 0], "key": "pid", - "memory_info": [459440128, - 13888520192, - 139042816, + "memory_info": [521797632, + 14051770368, + 142577664, 643072, 0, - 1830445056, + 1934319616, 0], - "memory_percent": 5.861741538419732, + "memory_percent": 6.657326314656288, "name": "firefox", "nice": 0, - "num_threads": 153, + "num_threads": 165, "pid": 10259, "ppid": 2922, "status": "S", @@ -960,69 +991,69 @@ GET quicklook Get plugin stats:: # curl http://localhost:61208/api/3/quicklook - {"cpu": 39.6, + {"cpu": 35.6, "cpu_hz": 3000000000.0, - "cpu_hz_current": 1792000.0, + "cpu_hz_current": 2860000.0, "cpu_name": "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz", - "mem": 60.3, + "mem": 81.4, "percpu": [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 57.0, + "idle": 56.9, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 7.0, - "total": 43.0, - "user": 26.0}, + "system": 4.6, + "total": 43.1, + "user": 38.5}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 68.0, + "idle": 73.8, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 6.0, - "total": 32.0, - "user": 17.0}, + "system": 4.6, + "total": 26.2, + "user": 21.5}, {"cpu_number": 2, "guest": 0.0, "guest_nice": 0.0, - "idle": 60.0, - "iowait": 0.0, + "idle": 56.1, + "iowait": 0.8, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 7.0, - "total": 40.0, - "user": 21.0}, + "system": 4.5, + "total": 43.9, + "user": 38.6}, {"cpu_number": 3, "guest": 0.0, "guest_nice": 0.0, - "idle": 31.0, + "idle": 69.9, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 5.0, - "total": 69.0, - "user": 54.0}], - "swap": 23.2} + "system": 3.0, + "total": 30.1, + "user": 27.1}], + "swap": 22.0} Get a specific field:: # curl http://localhost:61208/api/3/quicklook/cpu - {"cpu": 39.6} + {"cpu": 35.6} GET sensors ----------- @@ -1093,7 +1124,7 @@ GET uptime Get plugin stats:: # curl http://localhost:61208/api/3/uptime - {"seconds": 1370482} + {"seconds": 1495537} GET all stats ------------- @@ -1109,33 +1140,33 @@ GET stats history History of a plugin:: # curl http://localhost:61208/api/3/cpu/history - {"system": [["2022-05-24T12:02:07.760352", 7.0], - ["2022-05-24T12:02:08.818817", 7.0], - ["2022-05-24T12:02:09.906285", 1.1]], - "user": [["2022-05-24T12:02:07.760346", 30.8], - ["2022-05-24T12:02:08.818813", 30.8], - ["2022-05-24T12:02:09.906281", 5.8]]} + {"system": [["2022-05-25T22:46:23.083039", 4.3], + ["2022-05-25T22:46:24.140665", 4.3], + ["2022-05-25T22:46:25.239049", 5.5]], + "user": [["2022-05-25T22:46:23.083029", 27.0], + ["2022-05-25T22:46:24.140661", 27.0], + ["2022-05-25T22:46:25.239044", 10.7]]} Limit history to last 2 values:: # curl http://localhost:61208/api/3/cpu/history/2 - {"system": [["2022-05-24T12:02:08.818817", 7.0], - ["2022-05-24T12:02:09.906285", 1.1]], - "user": [["2022-05-24T12:02:08.818813", 30.8], - ["2022-05-24T12:02:09.906281", 5.8]]} + {"system": [["2022-05-25T22:46:24.140665", 4.3], + ["2022-05-25T22:46:25.239049", 5.5]], + "user": [["2022-05-25T22:46:24.140661", 27.0], + ["2022-05-25T22:46:25.239044", 10.7]]} History for a specific field:: # curl http://localhost:61208/api/3/cpu/system/history - {"system": [["2022-05-24T12:02:07.760352", 7.0], - ["2022-05-24T12:02:08.818817", 7.0], - ["2022-05-24T12:02:09.906285", 1.1]]} + {"system": [["2022-05-25T22:46:23.083039", 4.3], + ["2022-05-25T22:46:24.140665", 4.3], + ["2022-05-25T22:46:25.239049", 5.5]]} Limit history for a specific field to last 2 values:: # curl http://localhost:61208/api/3/cpu/system/history - {"system": [["2022-05-24T12:02:08.818817", 7.0], - ["2022-05-24T12:02:09.906285", 1.1]]} + {"system": [["2022-05-25T22:46:24.140665", 4.3], + ["2022-05-25T22:46:25.239049", 5.5]]} GET limits (used for thresholds) -------------------------------- diff --git a/docs/man/glances.1 b/docs/man/glances.1 index 87aa0b1c..2813c98e 100644 --- a/docs/man/glances.1 +++ b/docs/man/glances.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "GLANCES" "1" "May 24, 2022" "3.2.6" "Glances" +.TH "GLANCES" "1" "May 25, 2022" "3.2.6.3" "Glances" .SH NAME glances \- An eye on your system .SH SYNOPSIS diff --git a/glances/__init__.py b/glances/__init__.py index e550588c..b7438bf7 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -29,7 +29,7 @@ import sys # Global name # Version should start and end with a numerical char # See https://packaging.python.org/specifications/core-metadata/#version -__version__ = '3.2.6.2' +__version__ = '3.2.6.3' __author__ = 'Nicolas Hennion ' __license__ = 'LGPLv3' From 2d4309c0ebec6437854a18f6bb6708d073476830 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Wed, 25 May 2022 23:12:09 +0200 Subject: [PATCH 07/17] Update Makefile --- Makefile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 7de44fc7..4ea03bac 100644 --- a/Makefile +++ b/Makefile @@ -45,41 +45,41 @@ docs-server: docs webui: venv-dev cd glances/outputs/static/ && npm ci && npm run build -run: venv +run: ./venv/bin/python -m glances -C ./conf/glances.conf -run-debug: venv +run-debug: ./venv/bin/python -m glances -C ./conf/glances.conf -d -run-webserver: venv +run-webserver: ./venv/bin/python -m glances -C ./conf/glances.conf -w -run-restapiserver: venv +run-restapiserver: ./venv/bin/python -m glances -C ./conf/glances.conf -w --disable-webui -run-server: venv +run-server: ./venv/bin/python -m glances -C ./conf/glances.conf -s -run-client: venv +run-client: ./venv/bin/python -m glances -C ./conf/glances.conf -c localhost -run-browser: venv +run-browser: ./venv/bin/python -m glances -C ./conf/glances.conf --browser -show-version: venv +show-version: ./venv/bin/python -m glances -C ./conf/glances.conf -V -show-issue: venv +show-issue: ./venv/bin/python -m glances -C ./conf/glances.conf --issue -profiling: venv venv-dev +profiling: @echo "Please complete and run: sudo ./venv/bin/py-spy record -o ./docs/_static/glances-flame.svg -d 60 -s --pid " -trace-malloc: venv +trace-malloc: @echo "Malloc test is running, please wait ~30 secondes..." ./venv/bin/python -m glances -C ./conf/glances.conf --trace-malloc --stop-after 15 --quiet -memory-leak: venv +memory-leak: ./venv/bin/python -m glances -C ./conf/glances.conf --memory-leak release-note: From d9b568c0244375f8f9b19720bcffec8f774082ba Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 26 May 2022 09:35:42 +0200 Subject: [PATCH 08/17] Another dep issue solved in the Alpine Docker + issue in the outdated method --- glances/outdated.py | 2 +- optional-requirements.txt | 1 + setup.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/glances/outdated.py b/glances/outdated.py index b5816b39..f7f36e51 100644 --- a/glances/outdated.py +++ b/glances/outdated.py @@ -61,7 +61,7 @@ class Outdated(object): # Read the configuration file self.load_config(config) if not PACKAGING_IMPORT: - self.args.disable_check_update = False + self.args.disable_check_update = True logger.debug("Check Glances version up-to-date: {}".format(not self.args.disable_check_update)) # And update ! diff --git a/optional-requirements.txt b/optional-requirements.txt index 2e480cdd..944f55c7 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -28,6 +28,7 @@ python-dateutil pyzmq requests scandir; python_version < "3.5" +six sparklines statsd wifi diff --git a/setup.py b/setup.py index 05beac93..925b2206 100755 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ def get_install_extras_require(): 'action': ['chevron'], 'browser': ['zeroconf==0.19.1' if PY2 else 'zeroconf>=0.19.1'], 'cloud': ['requests'], - 'docker': ['docker>=2.0.0', 'python-dateutil'], + 'docker': ['docker>=2.0.0', 'python-dateutil', 'six'], 'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch', 'graphitesender', 'influxdb>=1.0.0', 'kafka-python', 'pika', 'paho-mqtt', 'potsdb', 'prometheus_client', 'pyzmq', From 86da9b1bb032a47c308399382d2cda4eeaaf1288 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 26 May 2022 10:28:51 +0200 Subject: [PATCH 09/17] Except datutil import error --- glances/plugins/glances_docker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glances/plugins/glances_docker.py b/glances/plugins/glances_docker.py index 520c63d1..7e2d54df 100644 --- a/glances/plugins/glances_docker.py +++ b/glances/plugins/glances_docker.py @@ -23,7 +23,6 @@ import os import threading import time from copy import deepcopy -from dateutil import parser from glances.compat import iterkeys, itervalues, nativestr, pretty_date from glances.logger import logger @@ -35,10 +34,11 @@ from glances.timer import getTimeSinceLastUpdate # https://github.com/docker/docker-py try: import docker + from dateutil import parser except Exception as e: import_error_tag = True # Display debug message if import KeyError - logger.warning("Error loading Docker Python Lib. Docker plugin is disabled ({})".format(e)) + logger.warning("Error loading Docker deps Lib. Docker plugin is disabled ({})".format(e)) else: import_error_tag = False From b2f60406548ab78f2967217b229b76ab5d8ac910 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 26 May 2022 11:25:38 +0200 Subject: [PATCH 10/17] Remove : from the load --- glances/plugins/glances_load.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glances/plugins/glances_load.py b/glances/plugins/glances_load.py index 8fbb9279..adaa0c45 100644 --- a/glances/plugins/glances_load.py +++ b/glances/plugins/glances_load.py @@ -176,7 +176,7 @@ class Plugin(GlancesPlugin): # Loop over 1min, 5min and 15min load for load_time in ['1', '5', '15']: ret.append(self.curse_new_line()) - msg = '{:8}'.format('{} min:'.format(load_time)) + msg = '{:8}'.format('{} min'.format(load_time)) ret.append(self.curse_add_line(msg)) if args.disable_irix and self.nb_log_core != 0: # Enable Irix mode for load (see issue #1554) From 5fb4187ae5db14c1a79910cd7e6bc42dd6c87da0 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 26 May 2022 11:41:56 +0200 Subject: [PATCH 11/17] Improve Irix display for the load plugin --- glances/plugins/glances_load.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/glances/plugins/glances_load.py b/glances/plugins/glances_load.py index adaa0c45..89efd45a 100644 --- a/glances/plugins/glances_load.py +++ b/glances/plugins/glances_load.py @@ -167,7 +167,7 @@ class Plugin(GlancesPlugin): # Build the string message # Header - msg = '{:6}'.format('LOAD%' if (args.disable_irix and self.nb_log_core != 0) else 'LOAD') + msg = '{:6}'.format('LOAD') ret.append(self.curse_add_line(msg, "TITLE")) # Core number if 'cpucore' in self.stats and self.stats['cpucore'] > 0: @@ -183,7 +183,11 @@ class Plugin(GlancesPlugin): load_stat = self.stats['min{}'.format(load_time)] / self.nb_log_core * 100 else: load_stat = self.stats['min{}'.format(load_time)] - msg = '{:>6.2f}'.format(load_stat) + # Manage IRIX display (see issue #1554) + if (args.disable_irix and self.nb_log_core != 0): + msg = '{:>5.1f}%'.format(load_stat) + else: + msg = '{:>6.2f}'.format(load_stat) if load_time == '1': ret.append(self.curse_add_line(msg)) else: From b33417831e2213786f874da5599decabba7a9a7c Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 26 May 2022 14:47:13 +0200 Subject: [PATCH 12/17] Update Flame profiling for version 3.2.6.4 --- docs/_static/glances-flame.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_static/glances-flame.svg b/docs/_static/glances-flame.svg index d8a4d407..7093e1ee 100644 --- a/docs/_static/glances-flame.svg +++ b/docs/_static/glances-flame.svg @@ -1,4 +1,4 @@ - \ No newline at end of file From 165357f746b6385b6288ba10bf5c2e66e54f7268 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 26 May 2022 14:58:35 +0200 Subject: [PATCH 13/17] Refactor Load plugin msg_curse method --- glances/plugins/glances_load.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/glances/plugins/glances_load.py b/glances/plugins/glances_load.py index 89efd45a..93e5fa48 100644 --- a/glances/plugins/glances_load.py +++ b/glances/plugins/glances_load.py @@ -181,17 +181,11 @@ class Plugin(GlancesPlugin): if args.disable_irix and self.nb_log_core != 0: # Enable Irix mode for load (see issue #1554) load_stat = self.stats['min{}'.format(load_time)] / self.nb_log_core * 100 - else: - load_stat = self.stats['min{}'.format(load_time)] - # Manage IRIX display (see issue #1554) - if (args.disable_irix and self.nb_log_core != 0): msg = '{:>5.1f}%'.format(load_stat) else: + # Default mode for load + load_stat = self.stats['min{}'.format(load_time)] msg = '{:>6.2f}'.format(load_stat) - if load_time == '1': - ret.append(self.curse_add_line(msg)) - else: - # Alert is only for 5 and 15 min - ret.append(self.curse_add_line(msg, self.get_views(key='min{}'.format(load_time), option='decoration'))) + ret.append(self.curse_add_line(msg, self.get_views(key='min{}'.format(load_time), option='decoration'))) return ret From 586ebd7099fb6fca47cf04f632c8cbf7f0450500 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Thu, 26 May 2022 15:21:48 +0200 Subject: [PATCH 14/17] Refactor comment --- glances/plugins/glances_load.py | 7 +++++-- glances/plugins/glances_mem.py | 2 +- glances/plugins/glances_plugin.py | 14 +++++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/glances/plugins/glances_load.py b/glances/plugins/glances_load.py index 93e5fa48..c30487c9 100644 --- a/glances/plugins/glances_load.py +++ b/glances/plugins/glances_load.py @@ -2,7 +2,7 @@ # # This file is part of Glances. # -# Copyright (C) 2019 Nicolargo +# Copyright (C) 2022 Nicolargo # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -47,7 +47,10 @@ waiting in the run-queue plus the number currently executing \ over 15 minutes.', 'unit': 'float', }, - 'cpucore': {'description': 'Total number of CPU core.', 'unit': 'number'}, + 'cpucore': { + 'description': 'Total number of CPU core.', + 'unit': 'number' + }, } # SNMP OID diff --git a/glances/plugins/glances_mem.py b/glances/plugins/glances_mem.py index f76c25b8..c1865893 100644 --- a/glances/plugins/glances_mem.py +++ b/glances/plugins/glances_mem.py @@ -2,7 +2,7 @@ # # This file is part of Glances. # -# Copyright (C) 2021 Nicolargo +# Copyright (C) 2022 Nicolargo # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py index 8dfb53e3..c06ccdb7 100644 --- a/glances/plugins/glances_plugin.py +++ b/glances/plugins/glances_plugin.py @@ -38,7 +38,9 @@ from glances.timer import Counter, Timer from glances.outputs.glances_unicode import unicode_message -fields_unit_short = {'percent': '%'} +fields_unit_short = { + 'percent': '%' +} fields_unit_type = { 'percent': 'float', @@ -52,7 +54,7 @@ fields_unit_type = { 'second': 'int', 'seconds': 'int', 'byte': 'int', - 'bytes': 'int', + 'bytes': 'int' } @@ -978,7 +980,7 @@ class GlancesPlugin(object): """Go to a new line.""" return self.curse_add_line('\n') - def curse_add_stat(self, key, width=None, header='', separator='', trailer=''): + def curse_add_stat(self, key, width=None, header='', display_key=True, separator='', trailer=''): """Return a list of dict messages with the 'key: value' result <=== width ===> @@ -986,8 +988,8 @@ class GlancesPlugin(object): | | | | |_ trailer | | | |_ self.stats[key] | | |_ separator - | |_ key - |_ trailer + | |_ key (if display_key is True) + |_ header Instead of: msg = ' {:8}'.format('idle:') @@ -1007,6 +1009,8 @@ class GlancesPlugin(object): key_name = self.fields_description[key]['short_name'] else: key_name = key + if not display_key: + key_name = '' # Check if unit is defined and get the short unit char in the unit_sort dict if ( From 87d90987a8699481035aa37576e2adcf6c68ffc4 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Fri, 27 May 2022 18:36:36 +0200 Subject: [PATCH 15/17] Refactor top menu of the curse interface --- glances/plugins/glances_cpu.py | 10 +++++----- glances/plugins/glances_load.py | 4 ++-- glances/plugins/glances_mem.py | 16 +++++++++++----- glances/plugins/glances_memswap.py | 10 +++++----- glances/plugins/glances_plugin.py | 8 ++++---- 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/glances/plugins/glances_cpu.py b/glances/plugins/glances_cpu.py index 6ca74856..7bb4c082 100644 --- a/glances/plugins/glances_cpu.py +++ b/glances/plugins/glances_cpu.py @@ -329,9 +329,9 @@ class Plugin(GlancesPlugin): ret.append(self.curse_add_line(msg, self.get_views(key='total', option='decoration'))) # Idle CPU if 'idle' in self.stats and not idle_tag: - msg = ' {:8}'.format('idle:') + msg = ' {:8}'.format('idle') ret.append(self.curse_add_line(msg, optional=self.get_views(key='idle', option='optional'))) - msg = '{:5.1f}%'.format(self.stats['idle']) + msg = '{:4.1f}%'.format(self.stats['idle']) ret.append(self.curse_add_line(msg, optional=self.get_views(key='idle', option='optional'))) # ctx_switches ret.extend(self.curse_add_stat('ctx_switches', width=15, header=' ')) @@ -345,7 +345,7 @@ class Plugin(GlancesPlugin): elif 'idle' in self.stats: ret.extend(self.curse_add_stat('idle', width=15)) # IRQ CPU - ret.extend(self.curse_add_stat('irq', width=15, header=' ')) + ret.extend(self.curse_add_stat('irq', width=14, header=' ')) # interrupts ret.extend(self.curse_add_stat('interrupts', width=15, header=' ')) @@ -358,7 +358,7 @@ class Plugin(GlancesPlugin): else: ret.extend(self.curse_add_stat('core', width=15)) # Nice CPU - ret.extend(self.curse_add_stat('nice', width=15, header=' ')) + ret.extend(self.curse_add_stat('nice', width=14, header=' ')) # soft_interrupts ret.extend(self.curse_add_stat('soft_interrupts', width=15, header=' ')) @@ -368,7 +368,7 @@ class Plugin(GlancesPlugin): # IOWait CPU ret.extend(self.curse_add_stat('iowait', width=15)) # Steal CPU usage - ret.extend(self.curse_add_stat('steal', width=15, header=' ')) + ret.extend(self.curse_add_stat('steal', width=14, header=' ')) # syscalls: number of system calls since boot. Always set to 0 on Linux. (do not display) if not LINUX: ret.extend(self.curse_add_stat('syscalls', width=15, header=' ')) diff --git a/glances/plugins/glances_load.py b/glances/plugins/glances_load.py index c30487c9..1896fa18 100644 --- a/glances/plugins/glances_load.py +++ b/glances/plugins/glances_load.py @@ -170,7 +170,7 @@ class Plugin(GlancesPlugin): # Build the string message # Header - msg = '{:6}'.format('LOAD') + msg = '{:5}'.format('LOAD') ret.append(self.curse_add_line(msg, "TITLE")) # Core number if 'cpucore' in self.stats and self.stats['cpucore'] > 0: @@ -179,7 +179,7 @@ class Plugin(GlancesPlugin): # Loop over 1min, 5min and 15min load for load_time in ['1', '5', '15']: ret.append(self.curse_new_line()) - msg = '{:8}'.format('{} min'.format(load_time)) + msg = '{:7}'.format('{} min'.format(load_time)) ret.append(self.curse_add_line(msg)) if args.disable_irix and self.nb_log_core != 0: # Enable Irix mode for load (see issue #1554) diff --git a/glances/plugins/glances_mem.py b/glances/plugins/glances_mem.py index c1865893..c104134f 100644 --- a/glances/plugins/glances_mem.py +++ b/glances/plugins/glances_mem.py @@ -57,11 +57,17 @@ note that this doesn\'t reflect the actual memory available (use \'available\' i 'unit': 'bytes', 'min_symbol': 'K', }, - 'inactive': {'description': '*(UNIX)*: memory that is marked as not used.', 'unit': 'bytes', 'min_symbol': 'K'}, + 'inactive': { + 'description': '*(UNIX)*: memory that is marked as not used.', + 'unit': 'bytes', + 'min_symbol': 'K', + 'short_name': 'inacti', + }, 'buffers': { 'description': '*(Linux, BSD)*: cache for things like file system metadata.', 'unit': 'bytes', 'min_symbol': 'K', + 'short_name': 'buffer', }, 'cached': {'description': '*(Linux, BSD)*: cache for various things.', 'unit': 'bytes', 'min_symbol': 'K'}, 'wired': { @@ -258,7 +264,7 @@ class Plugin(GlancesPlugin): msg = '{:>7.1%}'.format(self.stats['percent'] / 100) ret.append(self.curse_add_line(msg, self.get_views(key='percent', option='decoration'))) # Active memory usage - ret.extend(self.curse_add_stat('active', width=18, header=' ')) + ret.extend(self.curse_add_stat('active', width=16, header=' ')) # Second line # total + inactive @@ -266,7 +272,7 @@ class Plugin(GlancesPlugin): # Total memory usage ret.extend(self.curse_add_stat('total', width=15)) # Inactive memory usage - ret.extend(self.curse_add_stat('inactive', width=18, header=' ')) + ret.extend(self.curse_add_stat('inactive', width=16, header=' ')) # Third line # used + buffers @@ -274,7 +280,7 @@ class Plugin(GlancesPlugin): # Used memory usage ret.extend(self.curse_add_stat('used', width=15)) # Buffers memory usage - ret.extend(self.curse_add_stat('buffers', width=18, header=' ')) + ret.extend(self.curse_add_stat('buffers', width=16, header=' ')) # Fourth line # free + cached @@ -282,6 +288,6 @@ class Plugin(GlancesPlugin): # Free memory usage ret.extend(self.curse_add_stat('free', width=15)) # Cached memory usage - ret.extend(self.curse_add_stat('cached', width=18, header=' ')) + ret.extend(self.curse_add_stat('cached', width=16, header=' ')) return ret diff --git a/glances/plugins/glances_memswap.py b/glances/plugins/glances_memswap.py index c55e91d3..169245e7 100644 --- a/glances/plugins/glances_memswap.py +++ b/glances/plugins/glances_memswap.py @@ -172,9 +172,9 @@ class Plugin(GlancesPlugin): # First line # total% - msg = '{}'.format('SWAP') + msg = '{:4}'.format('SWAP') ret.append(self.curse_add_line(msg, "TITLE")) - msg = ' {:3}'.format(self.trend_msg(self.get_trend('percent'))) + msg = ' {:2}'.format(self.trend_msg(self.get_trend('percent'))) ret.append(self.curse_add_line(msg)) # Percent memory usage msg = '{:>6.1%}'.format(self.stats['percent'] / 100) @@ -184,18 +184,18 @@ class Plugin(GlancesPlugin): # total ret.append(self.curse_new_line()) # Total memory usage - ret.extend(self.curse_add_stat('total', width=16)) + ret.extend(self.curse_add_stat('total', width=15)) # Third line # used ret.append(self.curse_new_line()) # Used memory usage - ret.extend(self.curse_add_stat('used', width=16)) + ret.extend(self.curse_add_stat('used', width=15)) # Fourth line # free ret.append(self.curse_new_line()) # Free memory usage - ret.extend(self.curse_add_stat('free', width=16)) + ret.extend(self.curse_add_stat('free', width=15)) return ret diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py index c06ccdb7..8c706cdb 100644 --- a/glances/plugins/glances_plugin.py +++ b/glances/plugins/glances_plugin.py @@ -988,7 +988,7 @@ class GlancesPlugin(object): | | | | |_ trailer | | | |_ self.stats[key] | | |_ separator - | |_ key (if display_key is True) + | |_ 'short_name' description or key or nothing if display_key is True |_ header Instead of: @@ -1005,12 +1005,12 @@ class GlancesPlugin(object): return [] # Check if a shortname is defined - if key in self.fields_description and 'short_name' in self.fields_description[key]: + if not display_key: + key_name = '' + elif key in self.fields_description and 'short_name' in self.fields_description[key]: key_name = self.fields_description[key]['short_name'] else: key_name = key - if not display_key: - key_name = '' # Check if unit is defined and get the short unit char in the unit_sort dict if ( From 1292150478c53a5bd29bef5dd4f17b6184fadbb5 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 28 May 2022 17:50:59 +0200 Subject: [PATCH 16/17] Remove unused key in the process list --- glances/processes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glances/processes.py b/glances/processes.py index 1cbcc1bb..be357727 100644 --- a/glances/processes.py +++ b/glances/processes.py @@ -37,7 +37,7 @@ class GlancesProcesses(object): def __init__(self, cache_timeout=60): """Init the class to collect stats about processes.""" # Add internals caches because psutil do not cache all the stats - # See: https://code.google.com/p/psutil/issues/detail?id=462 + # See: https://github.com/giampaolo/psutil/issues/462 self.username_cache = {} self.cmdline_cache = {} @@ -46,7 +46,7 @@ class GlancesProcesses(object): # First iteration, no cache self.cache_timer = Timer(0) - # Init the io dict + # Init the io_old dict used to compute the IO bitrate # key = pid # value = [ read_bytes_old, write_bytes_old ] self.io_old = {} @@ -261,8 +261,8 @@ class GlancesProcesses(object): # Grab standard stats ##################### - sorted_attrs = ['cpu_percent', 'cpu_times', 'memory_percent', 'name', 'status', 'status', 'num_threads'] - displayed_attr = ['memory_info', 'nice', 'pid', 'ppid'] + sorted_attrs = ['cpu_percent', 'cpu_times', 'memory_percent', 'name', 'status', 'num_threads'] + displayed_attr = ['memory_info', 'nice', 'pid'] cached_attrs = ['cmdline', 'username'] # Some stats are optional From d2bbcfed8df9999e80291aecf326936916f19fbb Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 29 May 2022 13:02:21 +0200 Subject: [PATCH 17/17] Remove a except in the main display function. Replace it by a test on the screen size. --- glances/outputs/glances_curses.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 2afc9151..bc8cdc57 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -1059,8 +1059,7 @@ class _GlancesCurses(object): if not display_additional and m['additional']: continue # Is it possible to display the stat with the current screen size - # !!! Crash if not try/except... Why ??? - try: + if screen_x - x > 0: self.term_window.addnstr( y, x, @@ -1069,21 +1068,18 @@ class _GlancesCurses(object): screen_x - x, self.colors_list[m['decoration']], ) - except Exception: + # New column + # Python 2: we need to decode to get real screen size because + # UTF-8 special tree chars occupy several bytes. + # Python 3: strings are strings and bytes are bytes, all is + # good. + try: + x += len(u(m['msg'])) + except UnicodeDecodeError: + # Quick and dirty hack for issue #745 pass - else: - # New column - # Python 2: we need to decode to get real screen size because - # UTF-8 special tree chars occupy several bytes. - # Python 3: strings are strings and bytes are bytes, all is - # good. - try: - x += len(u(m['msg'])) - except UnicodeDecodeError: - # Quick and dirty hack for issue #745 - pass - if x > x_max: - x_max = x + if x > x_max: + x_max = x # Compute the next Glances column/line position self.next_column = max(self.next_column, x_max + self.space_between_column)