From 154ae8e6104041e05011715a8807edb8e5ad44fd Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 29 Jun 2024 16:36:22 +0200 Subject: [PATCH 1/7] On the road (again) to Glances 4.2.0 --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 51114d09..2d0c7274 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: glances -version: '4.1.0+build01' +version: '4.1.1+build01' # Put the current stable version+buildXX summary: Glances an Eye on your system. A top/htop alternative. description: | From 48103f167ebdcdad6e8e0af666d5a924c4affdf0 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 29 Jun 2024 16:43:47 +0200 Subject: [PATCH 2/7] Only test latest Python version on MacOS --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index efd24232..5465ba2f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -99,7 +99,8 @@ jobs: runs-on: macos-14 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + # Only test the latest stable version + python-version: ["3.12"] steps: From 60591630df4200addf1b288ed7225de40d2ffb1d Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 29 Jun 2024 19:01:25 +0200 Subject: [PATCH 3/7] Improve lisibility of OK_LOG --- glances/outputs/glances_curses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 1db8d752..6aed9a81 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -1211,7 +1211,7 @@ def build_colors_list(args): curses.init_pair(5, curses.COLOR_MAGENTA, -1) else: curses.init_pair(2, -1, curses.COLOR_RED) - curses.init_pair(3, -1, curses.COLOR_GREEN) + curses.init_pair(3, 0, curses.COLOR_GREEN) curses.init_pair(5, -1, curses.COLOR_MAGENTA) curses.init_pair(4, curses.COLOR_BLUE, -1) curses.init_pair(6, curses.COLOR_RED, -1) From f4c7ca01fe6408d61be62399cc4ba0ea36c7e08e Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 29 Jun 2024 19:19:26 +0200 Subject: [PATCH 4/7] Correct codespell --- CODE-OF-CONDUCT.md | 2 +- Makefile | 4 +- NEWS.rst | 24 +- README.rst | 8 +- conf/glances.conf | 2 +- .../docker-compose-with-traefik.yml | 2 +- docker-compose/docker-compose.yml | 2 +- docker-compose/glances.conf | 2 +- docs/aoa/cloud.rst | 2 +- docs/aoa/cpu.rst | 2 +- docs/aoa/header.rst | 2 +- docs/aoa/load.rst | 2 +- docs/aoa/memory.rst | 2 +- docs/api.rst | 526 +++++++++--------- docs/man/glances.1 | 2 +- glances/__init__.py | 2 +- glances/globals.py | 14 +- glances/plugins/README.rst | 2 +- glances/plugins/plugin/model.py | 2 +- glances/plugins/processlist/__init__.py | 2 +- glances/plugins/system/__init__.py | 2 +- glances/plugins/wifi/__init__.py | 2 +- glances/processes.py | 6 +- glances/stats.py | 4 +- 24 files changed, 299 insertions(+), 321 deletions(-) diff --git a/CODE-OF-CONDUCT.md b/CODE-OF-CONDUCT.md index 73df9aab..5c6c55ba 100644 --- a/CODE-OF-CONDUCT.md +++ b/CODE-OF-CONDUCT.md @@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, -education, socio-economic status, nationality, personal appearance, race, +education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards diff --git a/Makefile b/Makefile index b7e1e817..b92bf202 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ lint: ## Lint the code. ./venv-dev/bin/python -m ruff check . --fix codespell: ## Run codespell to fix common misspellings in text files - ./venv-dev/bin/codespell -S .git,./docs/_build,./Glances.egg-info,./venv*,./glances/outputs,*.svg -L hart,bu,te,statics + ./venv-dev/bin/codespell -S .git,./docs/_build,./Glances.egg-info,./venv*,./glances/outputs,*.svg -L hart,bu,te,statics -w semgrep: ## Run semgrep to find bugs and enforce code standards ./venv-dev/bin/semgrep scan --config=auto @@ -185,7 +185,7 @@ flatpak: venv-dev-upgrade ## Generate FlatPack JSON file rm -rf ./flatpak-builder-tools @echo "Now follow: https://github.com/flathub/flathub/wiki/App-Submission" -# Snap package is automaticaly build on the Snapcraft.io platform +# Snap package is automatically build on the Snapcraft.io platform # https://snapcraft.io/glances # But you can try an offline build with the following command snapcraft: diff --git a/NEWS.rst b/NEWS.rst index 6b2be9b7..efbcc7ba 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -31,8 +31,8 @@ Enhancements: Bug corrected: * API: Network module is disabled but appears in endpoint "all" #2815 -* API is not compatible with requests containing spcial/encoding char #2820 -* 'j' hot key crashs Glances #2831 +* API is not compatible with requests containing special/encoding char #2820 +* 'j' hot key crashes Glances #2831 * Raspberry PI - CPU info is not correct #2616 * Graph export is broken if there is no graph section in Glances configuration file #2839 * Glances API status check returns Error 405 - Method Not Allowed #2841 @@ -41,17 +41,17 @@ Bug corrected: * Exception when Glances is ran with limited plugin list #2822 * Disable separator option do not work #2823 -Continious integration and documentation: +Continuous integration and documentation: * test test_107_fs_plugin_method fails on aarch64-linux #2819 -Thanks to all contibutors and bug reporters ! +Thanks to all contributors and bug reporters ! Special thanks to: * Bharath Vignesh J K * RazCrimson -* Vadim Smal +* Vadim Small =============== Version 4.0.8 @@ -226,7 +226,7 @@ Many thinks to the contributors: * Christoph Zimmermann * RazCrimson * Robin Candau -* Github GPG acces +* Github GPG access * Continuous Integration * Georgiy Timchenko * turbocrime @@ -400,7 +400,7 @@ Documentation and CI: * Update Makefile with comments * Update Python minimal requirement for py3nvlm * Update security policy (user can open private issue directly in Github) -* Add a simple run script. Entry point for IDE debuger +* Add a simple run script. Entry point for IDE debugger Cyber security update: @@ -429,7 +429,7 @@ And also a big thanks to @RazCrimson (https://github.com/RazCrimson) for the sup Version 3.3.0.4 =============== -Refactor the Docker images factory, from now, only Alpine image wll be provided. +Refactor the Docker images factory, from now, only Alpine image will be provided. The following Docker images (nicolargo/glances) are availables: @@ -477,9 +477,9 @@ Bug corrected: * Correct issue with the regexp filter (use fullmatch instead of match) * Errors when running Glances as web service #1702 * Apply alias to Duplicate sensor name #1686 -* Make the hide function in sensors section compliant with lower/upercase #1590 +* Make the hide function in sensors section compliant with lower/uppercase #1590 * Web UI truncates the days part of CPU time counter of the process list #2108 -* Correct alignement issue with the diskio plugin (Console UI) +* Correct alignment issue with the diskio plugin (Console UI) Documentation and CI: @@ -746,7 +746,7 @@ Bugs corrected: * Docker containers information missing with Docker 20.10.x #1878 * Get system sensors temperatures thresholds #1864 -Contibutors for this version: +Contributors for this version: * Nicolargo * Markus Pöschl @@ -1353,7 +1353,7 @@ Enhancements and new features: * Add ZeroMQ exporter (issue #939) * Add CouchDB exporter (issue #928) * Add hotspot Wifi information (issue #937) -* Add default interface speed and automatic rate thresolds (issue #718) +* Add default interface speed and automatic rate thresholds (issue #718) * Highlight max stats in the processes list (issue #878) * Docker alerts and actions (issue #875) * Glances API returns the processes PPID (issue #926) diff --git a/README.rst b/README.rst index c5f064ba..7fbc4319 100644 --- a/README.rst +++ b/README.rst @@ -2,7 +2,7 @@ Glances - An eye on your system =============================== -| |pypi| |test| |contibutors| |quality| +| |pypi| |test| |contributors| |quality| | |starts| |docker| |pypistat| | |sponsors| |twitter| @@ -25,9 +25,9 @@ Glances - An eye on your system :target: https://github.com/nicolargo/glances/actions :alt: Linux tests (GitHub Actions) -.. |contibutors| image:: https://img.shields.io/github/contributors/nicolargo/glances +.. |contributors| image:: https://img.shields.io/github/contributors/nicolargo/glances :target: https://github.com/nicolargo/glances/issues?q=is%3Aissue+is%3Aopen+label%3A%22needs+contributor%22 - :alt: Contibutors + :alt: Contributors .. |quality| image:: https://scrutinizer-ci.com/g/nicolargo/glances/badges/quality-score.png?b=develop :target: https://scrutinizer-ci.com/g/nicolargo/glances/?branch=develop @@ -141,7 +141,7 @@ stable version. To install Glances, simply use the ``pip`` command line. Warning: on modern Linux operating systems, you may have an externally-managed-environment -error message when you try to use ``pip``. In this case, go to the the PipX section bellow. +error message when you try to use ``pip``. In this case, go to the the PipX section below. .. code-block:: console diff --git a/conf/glances.conf b/conf/glances.conf index 7bba30aa..faa94f9f 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -375,7 +375,7 @@ temperature_hdd_critical=60 battery_careful=80 battery_warning=90 battery_critical=95 -# Fan speed threashold in RPM +# Fan speed threshold in RPM #fan_speed_careful=100 # Sensors alias #alias=core 0:CPU Core 0,core 1:CPU Core 1 diff --git a/docker-compose/docker-compose-with-traefik.yml b/docker-compose/docker-compose-with-traefik.yml index 1f98d07b..06caf682 100644 --- a/docker-compose/docker-compose-with-traefik.yml +++ b/docker-compose/docker-compose-with-traefik.yml @@ -27,7 +27,7 @@ services: environment: - TZ=${TZ} - "GLANCES_OPT=-C /glances/conf/glances.conf -w" - # Uncomment for GPU compatibilty (Nvidia) inside the container + # Uncomment for GPU compatibility (Nvidia) inside the container # deploy: # resources: # reservations: diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 84e4bcf7..f446dad6 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -15,7 +15,7 @@ services: environment: - TZ=${TZ} - "GLANCES_OPT=-C /glances/conf/glances.conf -w" - # Uncomment for GPU compatibilty (Nvidia) inside the container + # Uncomment for GPU compatibility (Nvidia) inside the container # deploy: # resources: # reservations: diff --git a/docker-compose/glances.conf b/docker-compose/glances.conf index 11bcb951..0194b250 100755 --- a/docker-compose/glances.conf +++ b/docker-compose/glances.conf @@ -375,7 +375,7 @@ temperature_hdd_critical=60 battery_careful=80 battery_warning=90 battery_critical=95 -# Fan speed threashold in RPM +# Fan speed threshold in RPM #fan_speed_careful=100 # Sensors alias #alias=core 0:CPU Core 0,core 1:CPU Core 1 diff --git a/docs/aoa/cloud.rst b/docs/aoa/cloud.rst index d6214925..a65a2414 100644 --- a/docs/aoa/cloud.rst +++ b/docs/aoa/cloud.rst @@ -3,7 +3,7 @@ CLOUD ===== -This plugin diplays information about the cloud provider if your host is running on OpenStack. +This plugin displays information about the cloud provider if your host is running on OpenStack. The plugin use the standard OpenStack `metadata`_ service to retrieve the information. diff --git a/docs/aoa/cpu.rst b/docs/aoa/cpu.rst index 1124663c..c9e3ea83 100644 --- a/docs/aoa/cpu.rst +++ b/docs/aoa/cpu.rst @@ -53,7 +53,7 @@ To switch to per-CPU stats, just hit the ``1`` key: .. image:: ../_static/per-cpu.png In this case, Glances will show on line per logical CPU on the system. -If you have multiple core, it is possible to define the maximun number +If you have multiple core, it is possible to define the maximum number of CPU to display. The top 'max_cpu_display' will be display and an extra line with the mean of all others CPU will be added. diff --git a/docs/aoa/header.rst b/docs/aoa/header.rst index 62a3515b..23f07ab4 100644 --- a/docs/aoa/header.rst +++ b/docs/aoa/header.rst @@ -57,7 +57,7 @@ Example: **NOTE:** Setting low values for `public_refresh_interval` will result in frequent HTTP requests to the onlive service defined in public_api. Recommended range: 120-600 seconds. -Glances uses online services in order to get the IP addresses and the additional informations. +Glances uses online services in order to get the IP addresses and the additional information. Your IP address could be blocked if too many requests are done. diff --git a/docs/aoa/load.rst b/docs/aoa/load.rst index 57b1fc00..32924182 100644 --- a/docs/aoa/load.rst +++ b/docs/aoa/load.rst @@ -39,7 +39,7 @@ Trend Status ======== ============================================================== ``-`` Mean 15 lasts values equal mean 15 previous values ``↓`` Mean 15 lasts values is lower mean 15 previous values -``↑`` Mean 15 lasts values is higher mean 15 previous valuess +``↑`` Mean 15 lasts values is higher mean 15 previous values ======== ============================================================== Legend: diff --git a/docs/aoa/memory.rst b/docs/aoa/memory.rst index fa62764a..2e41584d 100644 --- a/docs/aoa/memory.rst +++ b/docs/aoa/memory.rst @@ -49,7 +49,7 @@ Trend Status ======== ============================================================== ``-`` Mean 15 lasts values equal mean 15 previous values ``↓`` Mean 15 lasts values is lower mean 15 previous values -``↑`` Mean 15 lasts values is higher mean 15 previous valuess +``↑`` Mean 15 lasts values is higher mean 15 previous values ======== ============================================================== Alerts are only set for used memory and used swap. diff --git a/docs/api.rst b/docs/api.rst index f4353810..4bb72447 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -141,7 +141,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.44504690170288086}, + "timer": 0.2482151985168457}, {"count": 0, "countmax": 20.0, "countmin": None, @@ -150,7 +150,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.4449424743652344}] + "timer": 0.24815130233764648}] Fields descriptions: @@ -178,7 +178,7 @@ Get a specific item when field matches the given value:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.44504690170288086}]} + "timer": 0.2482151985168457}]} GET cloud --------- @@ -265,19 +265,19 @@ Get plugin stats:: # curl http://localhost:61208/api/4/cpu {"cpucore": 16, - "ctx_switches": 427467586, + "ctx_switches": 493080568, "guest": 0.0, - "idle": 93.0, - "interrupts": 359749831, - "iowait": 0.1, + "idle": 86.5, + "interrupts": 420997918, + "iowait": 0.5, "irq": 0.0, "nice": 0.0, - "soft_interrupts": 133597275, + "soft_interrupts": 155707720, "steal": 0.0, "syscalls": 0, - "system": 2.7, - "total": 6.6, - "user": 4.3} + "system": 3.5, + "total": 12.9, + "user": 9.4} Fields descriptions: @@ -310,7 +310,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/cpu/total - {"total": 6.6} + {"total": 12.9} GET diskio ---------- @@ -320,10 +320,10 @@ Get plugin stats:: # curl http://localhost:61208/api/4/diskio [{"disk_name": "nvme0n1", "key": "disk_name", - "read_bytes": 7492967936, - "read_count": 277065, - "write_bytes": 24887440384, - "write_count": 1206489}, + "read_bytes": 10167291392, + "read_count": 391026, + "write_bytes": 31230641152, + "write_count": 1527146}, {"disk_name": "nvme0n1p1", "key": "disk_name", "read_bytes": 7558144, @@ -363,10 +363,10 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/diskio/disk_name/nvme0n1 {"nvme0n1": [{"disk_name": "nvme0n1", "key": "disk_name", - "read_bytes": 7492967936, - "read_count": 277065, - "write_bytes": 24887440384, - "write_count": 1206489}]} + "read_bytes": 10167291392, + "read_count": 391026, + "write_bytes": 31230641152, + "write_count": 1527146}]} GET folders ----------- @@ -393,13 +393,13 @@ Get plugin stats:: # curl http://localhost:61208/api/4/fs [{"device_name": "/dev/mapper/ubuntu--vg-ubuntu--lv", - "free": 896615452672, + "free": 897378041856, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 5.9, + "percent": 5.8, "size": 1003736440832, - "used": 56058482688}] + "used": 55295893504}] Fields descriptions: @@ -420,13 +420,13 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/fs/mnt_point// {"/": [{"device_name": "/dev/mapper/ubuntu--vg-ubuntu--lv", - "free": 896615452672, + "free": 897378041856, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 5.9, + "percent": 5.8, "size": 1003736440832, - "used": 56058482688}]} + "used": 55295893504}]} GET gpu ------- @@ -500,9 +500,9 @@ Get plugin stats:: # curl http://localhost:61208/api/4/load {"cpucore": 16, - "min1": 0.728515625, - "min15": 0.88916015625, - "min5": 0.81982421875} + "min1": 0.40185546875, + "min15": 0.587890625, + "min5": 0.638671875} Fields descriptions: @@ -514,7 +514,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/load/min1 - {"min1": 0.728515625} + {"min1": 0.40185546875} GET mem ------- @@ -522,16 +522,16 @@ GET mem Get plugin stats:: # curl http://localhost:61208/api/4/mem - {"active": 8275505152, - "available": 4275773440, - "buffers": 116162560, - "cached": 4656115712, - "free": 4275773440, - "inactive": 5691351040, - "percent": 74.0, - "shared": 789377024, + {"active": 5094199296, + "available": 10908983296, + "buffers": 180162560, + "cached": 5800796160, + "free": 10908983296, + "inactive": 3735175168, + "percent": 33.6, + "shared": 622718976, "total": 16422486016, - "used": 12146712576} + "used": 5513502720} Fields descriptions: @@ -558,13 +558,13 @@ GET memswap Get plugin stats:: # curl http://localhost:61208/api/4/memswap - {"free": 3367235584, - "percent": 21.6, - "sin": 12087296, - "sout": 929779712, + {"free": 3836997632, + "percent": 10.7, + "sin": 186925056, + "sout": 1518604288, "time_since_update": 1, "total": 4294963200, - "used": 927727616} + "used": 457965568} Fields descriptions: @@ -589,15 +589,15 @@ Get plugin stats:: # curl http://localhost:61208/api/4/network [{"alias": None, "bytes_all": 0, - "bytes_all_gauge": 5602788085, + "bytes_all_gauge": 6286191015, "bytes_recv": 0, - "bytes_recv_gauge": 5324413260, + "bytes_recv_gauge": 5977645732, "bytes_sent": 0, - "bytes_sent_gauge": 278374825, + "bytes_sent_gauge": 308545283, "interface_name": "wlp0s20f3", "key": "interface_name", "speed": 0, - "time_since_update": 0.4488046169281006}] + "time_since_update": 0.2501566410064697}] Fields descriptions: @@ -626,15 +626,15 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/network/interface_name/wlp0s20f3 {"wlp0s20f3": [{"alias": None, "bytes_all": 0, - "bytes_all_gauge": 5602788085, + "bytes_all_gauge": 6286191015, "bytes_recv": 0, - "bytes_recv_gauge": 5324413260, + "bytes_recv_gauge": 5977645732, "bytes_sent": 0, - "bytes_sent_gauge": 278374825, + "bytes_sent_gauge": 308545283, "interface_name": "wlp0s20f3", "key": "interface_name", "speed": 0, - "time_since_update": 0.4488046169281006}]} + "time_since_update": 0.2501566410064697}]} GET now ------- @@ -642,7 +642,7 @@ GET now Get plugin stats:: # curl http://localhost:61208/api/4/now - {"custom": "2024-06-29 09:55:18 CEST", "iso": "2024-06-29T09:55:18+02:00"} + {"custom": "2024-06-29 19:17:41 CEST", "iso": "2024-06-29T19:17:41+02:00"} Fields descriptions: @@ -652,7 +652,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/now/iso - {"iso": "2024-06-29T09:55:18+02:00"} + {"iso": "2024-06-29T19:17:41+02:00"} GET percpu ---------- @@ -663,7 +663,7 @@ Get plugin stats:: [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 36.0, + "idle": 21.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", @@ -671,12 +671,12 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 64.0, + "total": 79.0, "user": 1.0}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 37.0, + "idle": 23.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", @@ -684,7 +684,7 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 63.0, + "total": 77.0, "user": 0.0}] Fields descriptions: @@ -719,7 +719,7 @@ Get plugin stats:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.005775, + "status": 0.006275, "timeout": 3}] Fields descriptions: @@ -747,7 +747,7 @@ Get a specific item when field matches the given value:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.005775, + "status": 0.006275, "timeout": 3}]} GET processcount @@ -756,7 +756,7 @@ GET processcount Get plugin stats:: # curl http://localhost:61208/api/4/processcount - {"pid_max": 0, "running": 1, "sleeping": 281, "thread": 1660, "total": 426} + {"pid_max": 0, "running": 2, "sleeping": 277, "thread": 1508, "total": 412} Fields descriptions: @@ -769,7 +769,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/processcount/total - {"total": 426} + {"total": 412} GET processlist --------------- @@ -777,62 +777,40 @@ GET processlist Get plugin stats:: # curl http://localhost:61208/api/4/processlist - [{"cmdline": ["/snap/firefox/4336/usr/lib/firefox/firefox", - "-contentproc", - "-childID", - "2", - "-isForBrowser", - "-prefsLen", - "28296", - "-prefMapSize", - "244444", - "-jsInitLen", - "231800", - "-parentBuildID", - "20240527194810", - "-greomni", - "/snap/firefox/4336/usr/lib/firefox/omni.ja", - "-appomni", - "/snap/firefox/4336/usr/lib/firefox/browser/omni.ja", - "-appDir", - "/snap/firefox/4336/usr/lib/firefox/browser", - "{01aadc3d-85fc-4851-9ca1-a43a1e81c3fa}", - "4591", - "true", - "tab"], + [{"cmdline": ["/snap/firefox/4336/usr/lib/firefox/firefox"], "cpu_percent": 0.0, - "cpu_times": {"children_system": 0.0, - "children_user": 0.0, + "cpu_times": {"children_system": 3.08, + "children_user": 3.33, "iowait": 0.0, - "system": 123.83, - "user": 2750.68}, + "system": 13.75, + "user": 34.7}, "gids": {"effective": 1000, "real": 1000, "saved": 1000}, - "io_counters": [8411136, 0, 0, 0, 0], + "io_counters": [393136128, 195969024, 0, 0, 0], "key": "pid", - "memory_info": {"data": 3653316608, + "memory_info": {"data": 681967616, "dirty": 0, "lib": 0, - "rss": 3612418048, - "shared": 128864256, + "rss": 443969536, + "shared": 222199808, "text": 987136, - "vms": 6200733696}, - "memory_percent": 21.996779564802278, - "name": "Isolated Web Co", + "vms": 3721211904}, + "memory_percent": 2.7034246554842674, + "name": "firefox", "nice": 0, - "num_threads": 28, - "pid": 4848, + "num_threads": 120, + "pid": 793506, "status": "S", "time_since_update": 1, "username": "nicolargo"}, {"cmdline": ["/snap/firefox/4336/usr/lib/firefox/firefox", "-contentproc", "-childID", - "3", + "2", "-isForBrowser", "-prefsLen", - "28296", + "28218", "-prefMapSize", - "244444", + "244440", "-jsInitLen", "231800", "-parentBuildID", @@ -843,31 +821,31 @@ Get plugin stats:: "/snap/firefox/4336/usr/lib/firefox/browser/omni.ja", "-appDir", "/snap/firefox/4336/usr/lib/firefox/browser", - "{0ae685c6-7105-4724-886c-98d4a4a9a4f8}", - "4591", + "{bc853380-6b8f-46ad-afe0-9da5ba832e62}", + "793506", "true", "tab"], "cpu_percent": 0.0, "cpu_times": {"children_system": 0.0, "children_user": 0.0, "iowait": 0.0, - "system": 52.38, - "user": 492.92}, + "system": 2.54, + "user": 19.25}, "gids": {"effective": 1000, "real": 1000, "saved": 1000}, - "io_counters": [2974720, 0, 0, 0, 0], + "io_counters": [1827840, 0, 0, 0, 0], "key": "pid", - "memory_info": {"data": 1961992192, + "memory_info": {"data": 412688384, "dirty": 0, "lib": 0, - "rss": 1941671936, - "shared": 121491456, + "rss": 440922112, + "shared": 111878144, "text": 987136, - "vms": 4457148416}, - "memory_percent": 11.823252180627705, + "vms": 2946224128}, + "memory_percent": 2.684868244493684, "name": "Isolated Web Co", "nice": 0, "num_threads": 28, - "pid": 4852, + "pid": 793778, "status": "S", "time_since_update": 1, "username": "nicolargo"}] @@ -902,18 +880,18 @@ GET quicklook Get plugin stats:: # curl http://localhost:61208/api/4/quicklook - {"cpu": 6.6, + {"cpu": 12.9, "cpu_hz": 4475000000.0, - "cpu_hz_current": 570218562.5, + "cpu_hz_current": 1666410624.9999998, "cpu_log_core": 16, "cpu_name": "13th Gen Intel(R) Core(TM) i7-13620H", "cpu_phys_core": 10, - "load": 5.6, - "mem": 74.0, + "load": 3.7, + "mem": 33.6, "percpu": [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 36.0, + "idle": 21.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", @@ -921,12 +899,12 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 64.0, + "total": 79.0, "user": 1.0}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 37.0, + "idle": 23.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", @@ -934,64 +912,12 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 63.0, + "total": 77.0, "user": 0.0}, {"cpu_number": 2, "guest": 0.0, "guest_nice": 0.0, - "idle": 37.0, - "iowait": 0.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 0.0, - "softirq": 0.0, - "steal": 0.0, - "system": 0.0, - "total": 63.0, - "user": 0.0}, - {"cpu_number": 3, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 35.0, - "iowait": 0.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 0.0, - "softirq": 0.0, - "steal": 0.0, - "system": 0.0, - "total": 65.0, - "user": 2.0}, - {"cpu_number": 4, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 21.0, - "iowait": 0.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 0.0, - "softirq": 0.0, - "steal": 0.0, - "system": 2.0, - "total": 79.0, - "user": 15.0}, - {"cpu_number": 5, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 37.0, - "iowait": 0.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 0.0, - "softirq": 0.0, - "steal": 0.0, - "system": 0.0, - "total": 63.0, - "user": 1.0}, - {"cpu_number": 6, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 21.0, + "idle": 18.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", @@ -999,77 +925,64 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 1.0, - "total": 79.0, + "total": 82.0, + "user": 5.0}, + {"cpu_number": 3, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 22.0, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 0.0, + "total": 78.0, + "user": 0.0}, + {"cpu_number": 4, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 8.0, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 1.0, + "total": 92.0, + "user": 14.0}, + {"cpu_number": 5, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 23.0, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 0.0, + "total": 77.0, + "user": 0.0}, + {"cpu_number": 6, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 3.0, + "iowait": 1.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 4.0, + "total": 97.0, "user": 15.0}, {"cpu_number": 7, "guest": 0.0, "guest_nice": 0.0, - "idle": 38.0, - "iowait": 0.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 0.0, - "softirq": 0.0, - "steal": 0.0, - "system": 0.0, - "total": 62.0, - "user": 0.0}, - {"cpu_number": 8, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 37.0, - "iowait": 0.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 0.0, - "softirq": 0.0, - "steal": 0.0, - "system": 0.0, - "total": 63.0, - "user": 0.0}, - {"cpu_number": 9, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 38.0, - "iowait": 0.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 0.0, - "softirq": 0.0, - "steal": 0.0, - "system": 0.0, - "total": 62.0, - "user": 0.0}, - {"cpu_number": 10, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 37.0, - "iowait": 0.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 0.0, - "softirq": 0.0, - "steal": 0.0, - "system": 0.0, - "total": 63.0, - "user": 0.0}, - {"cpu_number": 11, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 37.0, - "iowait": 0.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 0.0, - "softirq": 0.0, - "steal": 0.0, - "system": 0.0, - "total": 63.0, - "user": 0.0}, - {"cpu_number": 12, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 36.0, + "idle": 23.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", @@ -1077,12 +990,77 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 1.0, - "total": 64.0, + "total": 77.0, + "user": 0.0}, + {"cpu_number": 8, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 19.0, + "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": 3.0}, + {"cpu_number": 9, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 22.0, + "iowait": 1.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 0.0, + "total": 78.0, + "user": 0.0}, + {"cpu_number": 10, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 22.0, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 0.0, + "total": 78.0, + "user": 0.0}, + {"cpu_number": 11, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 23.0, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 0.0, + "total": 77.0, + "user": 0.0}, + {"cpu_number": 12, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 21.0, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 1.0, + "total": 79.0, "user": 1.0}, {"cpu_number": 13, "guest": 0.0, "guest_nice": 0.0, - "idle": 37.0, + "idle": 23.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", @@ -1090,12 +1068,12 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 63.0, + "total": 77.0, "user": 0.0}, {"cpu_number": 14, "guest": 0.0, "guest_nice": 0.0, - "idle": 37.0, + "idle": 22.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", @@ -1103,12 +1081,12 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 63.0, + "total": 78.0, "user": 0.0}, {"cpu_number": 15, "guest": 0.0, "guest_nice": 0.0, - "idle": 37.0, + "idle": 22.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", @@ -1116,9 +1094,9 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 63.0, + "total": 78.0, "user": 0.0}], - "swap": 21.6} + "swap": 10.7} Fields descriptions: @@ -1156,14 +1134,14 @@ Get plugin stats:: "label": "Ambient", "type": "temperature_core", "unit": "C", - "value": 36, + "value": 39, "warning": 0}, {"critical": None, "key": "label", "label": "Ambient 3", "type": "temperature_core", "unit": "C", - "value": 31, + "value": 32, "warning": 0}] Fields descriptions: @@ -1224,7 +1202,7 @@ Get a specific item when field matches the given value:: "label": "Ambient", "type": "temperature_core", "unit": "C", - "value": 36, + "value": 39, "warning": 0}]} GET smart @@ -1255,7 +1233,7 @@ Fields descriptions: * **platform**: Platform (32 or 64 bits) (unit is *None*) * **linux_distro**: Linux distribution (unit is *None*) * **os_version**: Operating system version (unit is *None*) -* **hr_name**: Human readable operating sytem name (unit is *None*) +* **hr_name**: Human readable operating system name (unit is *None*) Get a specific field:: @@ -1268,7 +1246,7 @@ GET uptime Get plugin stats:: # curl http://localhost:61208/api/4/uptime - "19 days, 16:58:04" + "20 days, 2:20:27" GET version ----------- @@ -1276,7 +1254,7 @@ GET version Get plugin stats:: # curl http://localhost:61208/api/4/version - "4.1.0" + "4.2.0_beta01" GET wifi -------- @@ -1285,8 +1263,8 @@ Get plugin stats:: # curl http://localhost:61208/api/4/wifi [{"key": "ssid", - "quality_level": -58.0, - "quality_link": 52.0, + "quality_level": -59.0, + "quality_link": 51.0, "ssid": "wlp0s20f3"}] Get a specific field:: @@ -1298,8 +1276,8 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/wifi/ssid/wlp0s20f3 {"wlp0s20f3": [{"key": "ssid", - "quality_level": -58.0, - "quality_link": 52.0, + "quality_level": -59.0, + "quality_link": 51.0, "ssid": "wlp0s20f3"}]} GET all stats @@ -1344,34 +1322,34 @@ GET stats history History of a plugin:: # curl http://localhost:61208/api/4/cpu/history - {"system": [["2024-06-29T09:55:19.540650", 2.7], - ["2024-06-29T09:55:20.619021", 0.5], - ["2024-06-29T09:55:21.631678", 0.5]], - "user": [["2024-06-29T09:55:19.540644", 4.3], - ["2024-06-29T09:55:20.619018", 0.4], - ["2024-06-29T09:55:21.631673", 0.4]]} + {"system": [["2024-06-29T19:17:42.396270", 3.5], + ["2024-06-29T19:17:43.447397", 0.7], + ["2024-06-29T19:17:44.455830", 0.7]], + "user": [["2024-06-29T19:17:42.396268", 9.4], + ["2024-06-29T19:17:43.447396", 4.0], + ["2024-06-29T19:17:44.455825", 4.0]]} Limit history to last 2 values:: # curl http://localhost:61208/api/4/cpu/history/2 - {"system": [["2024-06-29T09:55:20.619021", 0.5], - ["2024-06-29T09:55:21.631678", 0.5]], - "user": [["2024-06-29T09:55:20.619018", 0.4], - ["2024-06-29T09:55:21.631673", 0.4]]} + {"system": [["2024-06-29T19:17:43.447397", 0.7], + ["2024-06-29T19:17:44.455830", 0.7]], + "user": [["2024-06-29T19:17:43.447396", 4.0], + ["2024-06-29T19:17:44.455825", 4.0]]} History for a specific field:: # curl http://localhost:61208/api/4/cpu/system/history - {"system": [["2024-06-29T09:55:18.389360", 2.7], - ["2024-06-29T09:55:19.540650", 2.7], - ["2024-06-29T09:55:20.619021", 0.5], - ["2024-06-29T09:55:21.631678", 0.5]]} + {"system": [["2024-06-29T19:17:41.318736", 3.5], + ["2024-06-29T19:17:42.396270", 3.5], + ["2024-06-29T19:17:43.447397", 0.7], + ["2024-06-29T19:17:44.455830", 0.7]]} Limit history for a specific field to last 2 values:: # curl http://localhost:61208/api/4/cpu/system/history - {"system": [["2024-06-29T09:55:20.619021", 0.5], - ["2024-06-29T09:55:21.631678", 0.5]]} + {"system": [["2024-06-29T19:17:43.447397", 0.7], + ["2024-06-29T19:17:44.455830", 0.7]]} GET limits (used for thresholds) -------------------------------- diff --git a/docs/man/glances.1 b/docs/man/glances.1 index c43028f7..ef009e0d 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" "Jun 29, 2024" "4.1.0" "Glances" +.TH "GLANCES" "1" "Jun 29, 2024" "4.2.0_beta01" "Glances" .SH NAME glances \- An eye on your system .SH SYNOPSIS diff --git a/glances/__init__.py b/glances/__init__.py index 71ec676f..0c947574 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -55,7 +55,7 @@ if psutil_version_info < psutil_min_version: def __signal_handler(signal, frame): - logger.debug(f"Signal {signal} catched") + logger.debug(f"Signal {signal} caught") end() diff --git a/glances/globals.py b/glances/globals.py index 96d8f781..0060e3d1 100644 --- a/glances/globals.py +++ b/glances/globals.py @@ -89,7 +89,7 @@ def printandflush(string): def to_ascii(s): """Convert the bytes string to a ASCII string - Usefull to remove accent (diacritics)""" + Useful to remove accent (diacritics)""" if isinstance(s, binary_type): return s.decode() return s.encode('ascii', 'ignore').decode() @@ -153,7 +153,7 @@ def subsample(data, sampling): Data should be a list of numerical itervalues - Return a subsampled list of sampling lenght + Return a subsampled list of sampling length """ if len(data) <= sampling: return data @@ -216,13 +216,13 @@ def key_exist_value_not_none(k, d): return k in d and d[k] is not None -def key_exist_value_not_none_not_v(k, d, value='', lengh=None): +def key_exist_value_not_none_not_v(k, d, value='', length=None): # Return True if: # - key k exists # - d[k] is not None # - d[k] != value - # - if lengh is not None and len(d[k]) >= lengh - return k in d and d[k] is not None and d[k] != value and (lengh is None or len(d[k]) >= lengh) + # - if length is not None and len(d[k]) >= length + return k in d and d[k] is not None and d[k] != value and (length is None or len(d[k]) >= length) def disable(class_name, var): @@ -425,12 +425,12 @@ def weak_lru_cache(maxsize=128, typed=False): def namedtuple_to_dict(data): - """Convert a namedtuple to a dict, using the _asdict() method embeded in PsUtil stats.""" + """Convert a namedtuple to a dict, using the _asdict() method embedded in PsUtil stats.""" return {k: (v._asdict() if hasattr(v, '_asdict') else v) for k, v in data.items()} def list_of_namedtuple_to_list_of_dict(data): - """Convert a list of namedtuples to a dict, using the _asdict() method embeded in PsUtil stats.""" + """Convert a list of namedtuples to a dict, using the _asdict() method embedded in PsUtil stats.""" return [namedtuple_to_dict(d) for d in data] diff --git a/glances/plugins/README.rst b/glances/plugins/README.rst index 32da654e..8f8ef56c 100644 --- a/glances/plugins/README.rst +++ b/glances/plugins/README.rst @@ -11,7 +11,7 @@ It should implement a Class named PluginModel (inherited from GlancesPluginModel This class should be based on the MVC model. - model: where the stats are updated (update method) - view: where the stats are prepare to be displayed (update_views) -- controler: where the stats are displayed (msg_curse method) +- controller: where the stats are displayed (msg_curse method) A plugin should define the following global variables: diff --git a/glances/plugins/plugin/model.py b/glances/plugins/plugin/model.py index daf4d8e6..53423c1f 100644 --- a/glances/plugins/plugin/model.py +++ b/glances/plugins/plugin/model.py @@ -98,7 +98,7 @@ class GlancesPluginModel: logger.debug(f'Load section {self.plugin_name} in Glances configuration file') self.load_limits(config=config) - # Init the alias (dictionnary) + # Init the alias (dictionary) self.alias = self.read_alias() # Init the actions diff --git a/glances/plugins/processlist/__init__.py b/glances/plugins/processlist/__init__.py index 17a4af65..bedd8285 100644 --- a/glances/plugins/processlist/__init__.py +++ b/glances/plugins/processlist/__init__.py @@ -543,7 +543,7 @@ class PluginModel(GlancesPluginModel): # Process list # Loop over processes (sorted by the sort key previously compute) # This is a Glances bottleneck (see flame graph), - # TODO: get_process_curses_data should be optimzed + # TODO: get_process_curses_data should be optimized for position, process in enumerate(processes_list_sorted): ret.extend(self.get_process_curses_data(process, position == args.cursor_position, args)) diff --git a/glances/plugins/system/__init__.py b/glances/plugins/system/__init__.py index ad0d7040..82933cc0 100644 --- a/glances/plugins/system/__init__.py +++ b/glances/plugins/system/__init__.py @@ -48,7 +48,7 @@ fields_description = { 'description': 'Operating system version', }, 'hr_name': { - 'description': 'Human readable operating sytem name', + 'description': 'Human readable operating system name', }, } diff --git a/glances/plugins/wifi/__init__.py b/glances/plugins/wifi/__init__.py index 0781c978..4b8a5215 100644 --- a/glances/plugins/wifi/__init__.py +++ b/glances/plugins/wifi/__init__.py @@ -8,7 +8,7 @@ """Wifi plugin. -Stats are retreived from the /proc/net/wireless file (Linux only): +Stats are retrieved from the /proc/net/wireless file (Linux only): # cat /proc/net/wireless Inter-| sta-| Quality | Discarded packets | Missed | WE diff --git a/glances/processes.py b/glances/processes.py index 9487b9ef..66f9e452 100644 --- a/glances/processes.py +++ b/glances/processes.py @@ -293,7 +293,7 @@ class GlancesProcesses: # - connections (TCP and UDP) # - CPU min/max/mean - # Set the extended stats list (OS dependant) + # Set the extended stats list (OS dependent) extended_stats = ['cpu_affinity', 'ionice', 'num_ctx_switches'] if LINUX: # num_fds only available on Unix system (see issue #1351) @@ -418,7 +418,7 @@ class GlancesProcesses: ##################### sorted_attrs = ['cpu_percent', 'cpu_times', 'memory_percent', 'name', 'status', 'num_threads'] displayed_attr = ['memory_info', 'nice', 'pid'] - # The following attributes are cached and only retreive every self.cache_timeout seconds + # The following attributes are cached and only retrieve every self.cache_timeout seconds # Warning: 'name' can not be cached because it is used for filtering cached_attrs = ['cmdline', 'username'] @@ -454,7 +454,7 @@ class GlancesProcesses: ) # Only get the info key # PsUtil 6+ no longer check PID reused #2755 so use is_running in the loop - # Note: not sure it is realy needed but CPU consumption look teh same with or without it + # Note: not sure it is realy needed but CPU consumption look the same with or without it processlist = [p.info for p in processlist if p.is_running()] # Sort the processes list by the current sort_key processlist = sort_stats(processlist, sorted_by=self.sort_key, reverse=True) diff --git a/glances/stats.py b/glances/stats.py index e033723f..8863dd45 100644 --- a/glances/stats.py +++ b/glances/stats.py @@ -136,7 +136,7 @@ class GlancesStats: """Load additional plugins if defined""" def get_addl_plugins(self, plugin_path): - """Get list of additonal plugins""" + """Get list of additional plugins""" _plugin_list = [] for plugin in os.listdir(plugin_path): path = os.path.join(plugin_path, plugin) @@ -167,7 +167,7 @@ class GlancesStats: sys.path.insert(0, path) for plugin in get_addl_plugins(self, path): if plugin in sys.modules: - logger.warn(f"Pugin {plugin} already in sys.modules, skipping (workaround: rename plugin)") + logger.warn(f"Plugin {plugin} already in sys.modules, skipping (workaround: rename plugin)") else: start_duration.reset() try: From 0e1d462c6902329bb141f84ff0954c58edc58a99 Mon Sep 17 00:00:00 2001 From: Bharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com> Date: Sun, 30 Jun 2024 01:33:51 +0530 Subject: [PATCH 5/7] chg: exports (influxdb) - log warning message if export fails --- glances/exports/glances_influxdb/__init__.py | 4 ++-- glances/exports/glances_influxdb2/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glances/exports/glances_influxdb/__init__.py b/glances/exports/glances_influxdb/__init__.py index b0ae1ee8..cff8012c 100644 --- a/glances/exports/glances_influxdb/__init__.py +++ b/glances/exports/glances_influxdb/__init__.py @@ -156,7 +156,7 @@ class Export(GlancesExport): try: self.client.write_points(self._normalize(name, columns, points), time_precision="s") except Exception as e: - # Log level set to debug instead of error (see: issue #1561) - logger.debug(f"Cannot export {name} stats to InfluxDB ({e})") + # Log level set to warning instead of error (see: issue #1561) + logger.warning(f"Cannot export {name} stats to InfluxDB ({e})") else: logger.debug(f"Export {name} stats to InfluxDB") diff --git a/glances/exports/glances_influxdb2/__init__.py b/glances/exports/glances_influxdb2/__init__.py index 75e7698c..62d90a54 100644 --- a/glances/exports/glances_influxdb2/__init__.py +++ b/glances/exports/glances_influxdb2/__init__.py @@ -164,7 +164,7 @@ class Export(GlancesExport): try: self.client.write(self.bucket, self.org, self._normalize(name, columns, points), time_precision="s") except Exception as e: - # Log level set to debug instead of error (see: issue #1561) - logger.debug(f"Cannot export {name} stats to InfluxDB ({e})") + # Log level set to warning instead of error (see: issue #1561) + logger.warning(f"Cannot export {name} stats to InfluxDB ({e})") else: logger.debug(f"Export {name} stats to InfluxDB") From 99e65079a030ea5d8e3248df248e100ec9abccfc Mon Sep 17 00:00:00 2001 From: Bharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com> Date: Sun, 30 Jun 2024 03:52:09 +0530 Subject: [PATCH 6/7] chg: plugin(docker) - add some typing --- glances/plugins/containers/__init__.py | 99 ++++++++----------- .../plugins/containers/engines/__init__.py | 9 ++ glances/plugins/containers/engines/docker.py | 2 +- glances/plugins/containers/engines/podman.py | 2 +- 4 files changed, 52 insertions(+), 60 deletions(-) diff --git a/glances/plugins/containers/__init__.py b/glances/plugins/containers/__init__.py index 08004e52..d906dd37 100644 --- a/glances/plugins/containers/__init__.py +++ b/glances/plugins/containers/__init__.py @@ -8,12 +8,14 @@ """Containers plugin.""" -import os from copy import deepcopy +from typing import Any, Dict, List, Optional, Tuple +from glances.globals import iteritems, itervalues from glances.logger import logger -from glances.plugins.containers.engines.docker import DockerContainersExtension, import_docker_error_tag -from glances.plugins.containers.engines.podman import PodmanContainersExtension, import_podman_error_tag +from glances.plugins.containers.engines import ContainersExtension +from glances.plugins.containers.engines.docker import DockerExtension, import_docker_error_tag +from glances.plugins.containers.engines.podman import PodmanExtension, import_podman_error_tag from glances.plugins.plugin.model import GlancesPluginModel from glances.processes import glances_processes from glances.processes import sort_stats as sort_stats_processes @@ -139,14 +141,15 @@ class PluginModel(GlancesPluginModel): # We want to display the stat in the curse interface self.display_curse = True + self.watchers: Dict[str, ContainersExtension] = {} + # Init the Docker API - self.docker_extension = DockerContainersExtension() if not import_docker_error_tag else None + if not import_docker_error_tag: + self.watchers['docker'] = DockerExtension() # Init the Podman API - if import_podman_error_tag: - self.podman_extension = None - else: - self.podman_extension = PodmanContainersExtension(podman_sock=self._podman_sock()) + if not import_podman_error_tag: + self.watchers['podman'] = PodmanExtension(podman_sock=self._podman_sock()) # Sort key self.sort_key = None @@ -155,7 +158,7 @@ class PluginModel(GlancesPluginModel): self.update() self.refresh_timer.set(0) - def _podman_sock(self): + def _podman_sock(self) -> str: """Return the podman sock. Could be desfined in the [docker] section thanks to the podman_sock option. Default value: unix:///run/user/1000/podman/podman.sock @@ -165,20 +168,19 @@ class PluginModel(GlancesPluginModel): return "unix:///run/user/1000/podman/podman.sock" return conf_podman_sock[0] - def exit(self): + def exit(self) -> None: """Overwrite the exit method to close threads.""" - if self.docker_extension: - self.docker_extension.stop() - if self.podman_extension: - self.podman_extension.stop() + for watcher in itervalues(self.watchers): + watcher.stop() + # Call the father class super().exit() - def get_key(self): + def get_key(self) -> str: """Return the key of the list.""" return 'name' - def get_export(self): + def get_export(self) -> List[Dict]: """Overwrite the default export method. - Only exports containers @@ -197,7 +199,7 @@ class PluginModel(GlancesPluginModel): return ret - def _all_tag(self): + def _all_tag(self) -> bool: """Return the all tag of the Glances/Docker configuration file. # By default, Glances only display running containers @@ -211,52 +213,35 @@ class PluginModel(GlancesPluginModel): @GlancesPluginModel._check_decorator @GlancesPluginModel._log_result_decorator - def update(self): + def update(self) -> List[Dict]: """Update Docker and podman stats using the input method.""" # Connection should be ok - if self.docker_extension is None and self.podman_extension is None: + if not self.watchers: return self.get_init_value() - if self.input_method == 'local': - # Update stats - stats_docker = self.update_docker() if self.docker_extension else {} - stats_podman = self.update_podman() if self.podman_extension else {} - stats = stats_docker.get('containers', []) + stats_podman.get('containers', []) - elif self.input_method == 'snmp': - # Update stats using SNMP - # Not available - pass + if self.input_method != 'local': + return self.get_init_value() + + # Update stats + stats = [] + for engine, watcher in iteritems(self.watchers): + version, containers = watcher.update(all_tag=self._all_tag()) + for container in containers: + container["engine"] = 'docker' + stats.extend(containers) # Sort and update the stats # @TODO: Have a look because sort did not work for the moment (need memory stats ?) self.sort_key, self.stats = sort_docker_stats(stats) - return self.stats - def update_docker(self): - """Update Docker stats using the input method.""" - version, containers = self.docker_extension.update(all_tag=self._all_tag()) - for container in containers: - container["engine"] = 'docker' - return {"version": version, "containers": containers} - - def update_podman(self): - """Update Podman stats.""" - version, containers = self.podman_extension.update(all_tag=self._all_tag()) - for container in containers: - container["engine"] = 'podman' - return {"version": version, "containers": containers} - - def get_user_ticks(self): - """Return the user ticks by reading the environment variable.""" - return os.sysconf(os.sysconf_names['SC_CLK_TCK']) - - def memory_usage_no_cache(self, mem): + @staticmethod + def memory_usage_no_cache(mem: Dict[str, float]) -> float: """Return the 'real' memory usage by removing inactive_file to usage""" # Ref: https://github.com/docker/docker-py/issues/3210 return mem['usage'] - (mem['inactive_file'] if 'inactive_file' in mem else 0) - def update_views(self): + def update_views(self) -> bool: """Update stats views.""" # Call the father's method super().update_views() @@ -305,7 +290,7 @@ class PluginModel(GlancesPluginModel): return True - def msg_curse(self, args=None, max_width=None): + def msg_curse(self, args=None, max_width: Optional[int] = None) -> List[str]: """Return the dict to display in the curse interface.""" # Init the return message ret = [] @@ -369,7 +354,9 @@ class PluginModel(GlancesPluginModel): if self.views['show_pod_name']: ret.append(self.curse_add_line(' {:{width}}'.format(container.get("pod_id", "-"), width=12))) # Name - ret.append(self.curse_add_line(self._msg_name(container=container, max_width=name_max_width))) + ret.append( + self.curse_add_line(' {:{width}}'.format(container['name'][:name_max_width], width=name_max_width)) + ) # Status status = self.container_alert(container['status']) msg = '{:>10}'.format(container['status'][0:10]) @@ -441,12 +428,8 @@ class PluginModel(GlancesPluginModel): return ret - def _msg_name(self, container, max_width): - """Build the container name.""" - name = container['name'][:max_width] - return ' {:{width}}'.format(name, width=max_width) - - def container_alert(self, status): + @staticmethod + def container_alert(status: str) -> str: """Analyse the container status.""" if status == 'running': return 'OK' @@ -457,7 +440,7 @@ class PluginModel(GlancesPluginModel): return 'CAREFUL' -def sort_docker_stats(stats): +def sort_docker_stats(stats: List[Dict[str, Any]]) -> Tuple[str, List[Dict[str, Any]]]: # Sort Docker stats using the same function than processes sort_by = glances_processes.sort_key sort_by_secondary = 'memory_usage' diff --git a/glances/plugins/containers/engines/__init__.py b/glances/plugins/containers/engines/__init__.py index e69de29b..d72e1328 100644 --- a/glances/plugins/containers/engines/__init__.py +++ b/glances/plugins/containers/engines/__init__.py @@ -0,0 +1,9 @@ +from typing import Any, Dict, Protocol, Tuple + + +class ContainersExtension(Protocol): + def stop(self) -> None: + raise NotImplementedError + + def update(self, all_tag) -> Tuple[Dict, list[Dict[str, Any]]]: + raise NotImplementedError diff --git a/glances/plugins/containers/engines/docker.py b/glances/plugins/containers/engines/docker.py index 81e94174..3f2cb5c6 100644 --- a/glances/plugins/containers/engines/docker.py +++ b/glances/plugins/containers/engines/docker.py @@ -207,7 +207,7 @@ class DockerStatsFetcher: return stats -class DockerContainersExtension: +class DockerExtension: """Glances' Containers Plugin's Docker Extension unit""" CONTAINER_ACTIVE_STATUS = ['running', 'paused'] diff --git a/glances/plugins/containers/engines/podman.py b/glances/plugins/containers/engines/podman.py index c913a58d..edbc952d 100644 --- a/glances/plugins/containers/engines/podman.py +++ b/glances/plugins/containers/engines/podman.py @@ -243,7 +243,7 @@ class PodmanPodStatsFetcher: return {"ior": ior, "iow": iow, "time_since_update": 1} -class PodmanContainersExtension: +class PodmanExtension: """Glances' Containers Plugin's Docker Extension unit""" CONTAINER_ACTIVE_STATUS = ['running', 'paused'] From 90f4934c62eac8c42ab4df82e5e735901113570f Mon Sep 17 00:00:00 2001 From: nicolargo Date: Wed, 3 Jul 2024 19:41:40 +0200 Subject: [PATCH 7/7] Glances 4.1.2 --- NEWS.rst | 8 ++++++++ glances/__init__.py | 2 +- snap/snapcraft.yaml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index efbcc7ba..1ce3bd9a 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -10,6 +10,14 @@ Under development, see roadmap here: https://github.com/nicolargo/glances/milest Contributors are welcome ! +=============== +Version 4.1.2 +=============== + +Bug corrected: + +* AttributeError: 'CpuPercent' object has no attribute 'cpu_percent' #2859 + =============== Version 4.1.1 =============== diff --git a/glances/__init__.py b/glances/__init__.py index 0c947574..40bb6410 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -19,7 +19,7 @@ import tracemalloc # Global name # Version should start and end with a numerical char # See https://packaging.python.org/specifications/core-metadata/#version -__version__ = '4.2.0_beta01' +__version__ = '4.1.2' __apiversion__ = '4' __author__ = 'Nicolas Hennion ' __license__ = 'LGPLv3' diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 2d0c7274..28aa2fc4 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: glances -version: '4.1.1+build01' # Put the current stable version+buildXX +version: '4.1.2+build01' # Put the current stable version+buildXX summary: Glances an Eye on your system. A top/htop alternative. description: |