From ef2f949f04808613a459fa8739fc685304df4097 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Mon, 14 Aug 2023 10:30:20 +0200 Subject: [PATCH 001/126] Implement a new API method to limit the number of returned list object #2491 --- glances/outputs/glances_bottle.py | 35 ++++++++++++++++++++++-- glances/outputs/glances_stdout_apidoc.py | 20 ++++++++++++++ glances/plugins/wifi/model.py | 32 ++++++++++------------ unitest-restful.py | 12 ++++++++ 4 files changed, 79 insertions(+), 20 deletions(-) diff --git a/glances/outputs/glances_bottle.py b/glances/outputs/glances_bottle.py index deb47b19..df6cfc71 100644 --- a/glances/outputs/glances_bottle.py +++ b/glances/outputs/glances_bottle.py @@ -2,12 +2,12 @@ # # This file is part of Glances. # -# SPDX-FileCopyrightText: 2022 Nicolas Hennion +# SPDX-FileCopyrightText: 2023 Nicolas Hennion # # SPDX-License-Identifier: LGPL-3.0-only # -"""Web interface class.""" +"""RestFull API interface class.""" import os import sys @@ -152,6 +152,7 @@ class GlancesBottle(object): self._app.route( '/api/%s//history/' % self.API_VERSION, method="GET", callback=self._api_history ) + self._app.route('/api/%s//top/' % self.API_VERSION, method="GET", callback=self._api_top) self._app.route('/api/%s//limits' % self.API_VERSION, method="GET", callback=self._api_limits) self._app.route('/api/%s//views' % self.API_VERSION, method="GET", callback=self._api_views) self._app.route('/api/%s//' % self.API_VERSION, method="GET", callback=self._api_item) @@ -393,6 +394,36 @@ class GlancesBottle(object): return statval + @compress + def _api_top(self, plugin, nb=0): + """Glances API RESTful implementation. + + Return the JSON representation of a given plugin limited to the top nb items. + It is used to reduce the payload of the HTTP response (example: processlist). + + HTTP/200 if OK + HTTP/400 if plugin is not found + HTTP/404 if others error + """ + response.content_type = 'application/json; charset=utf-8' + + if plugin not in self.plugins_list: + abort(400, "Unknown plugin %s (available plugins: %s)" % (plugin, self.plugins_list)) + + # Update the stat + self.__update__() + + try: + # Get the value of the stat ID + statval = self.stats.get_plugin(plugin).get_export() + except Exception as e: + abort(404, "Cannot get plugin %s (%s)" % (plugin, str(e))) + + if isinstance(statval, list): + return json_dumps(statval[:nb]) + else: + return json_dumps(statval) + @compress def _api_history(self, plugin, nb=0): """Glances API RESTful implementation. diff --git a/glances/outputs/glances_stdout_apidoc.py b/glances/outputs/glances_stdout_apidoc.py index c57eefa5..ed9c2da1 100644 --- a/glances/outputs/glances_stdout_apidoc.py +++ b/glances/outputs/glances_stdout_apidoc.py @@ -163,6 +163,22 @@ def print_all(): print('') +def print_top(stats): + time.sleep(1) + stats.update() + sub_title = 'GET top n items of a specific plugin' + print(sub_title) + print('-' * len(sub_title)) + print('') + print('Get top 2 processes of the processlist plugin::') + print('') + print(' # curl {}/processlist/top/2'.format(API_URL)) + print(indent_stat(stats.get_plugin('processlist').get_export()[:2])) + print('') + print('Note: Only work for plugin with a list of items') + print('') + + def print_history(stats): time.sleep(1) stats.update() @@ -248,6 +264,10 @@ class GlancesStdoutApiDoc(object): # Get all stats print_all() + # Get top stats (only for plugins with a list of items) + # Example for processlist plugin: get top 2 processes + print_top(stats) + # History print_history(stats) diff --git a/glances/plugins/wifi/model.py b/glances/plugins/wifi/model.py index 7d13fcaf..c221d688 100644 --- a/glances/plugins/wifi/model.py +++ b/glances/plugins/wifi/model.py @@ -47,8 +47,7 @@ WIRELESS_FILE = '/proc/net/wireless' wireless_file_exists = file_exists(WIRELESS_FILE) if not nmcli_command_exists and not wireless_file_exists: - logger.debug("Wifi plugin is disabled (no %s command or %s file found)" % ('nmcli', - WIRELESS_FILE)) + logger.debug("Wifi plugin is disabled (no %s command or %s file found)" % ('nmcli', WIRELESS_FILE)) class PluginModel(GlancesPluginModel): @@ -121,12 +120,14 @@ class PluginModel(GlancesPluginModel): # Extract the stats wifi_stats = wifi_stats.split() # Add the Wifi link to the list - stats.append({ - 'key': self.get_key(), - 'ssid': wifi_stats[0][:-1], - 'signal': float(wifi_stats[3]), - 'security': '' - }) + stats.append( + { + 'key': self.get_key(), + 'ssid': wifi_stats[0][:-1], + 'signal': float(wifi_stats[3]), + 'security': '', + } + ) # Next line wifi_stats = f.readline() @@ -202,11 +203,11 @@ class PluginModel(GlancesPluginModel): hotspot_name = i['ssid'] # Cut hotspot_name if it is too long if len(hotspot_name) > if_name_max_width: - hotspot_name = '_' + hotspot_name[-if_name_max_width - len(i['security']) + 1:] + hotspot_name = '_' + hotspot_name[-if_name_max_width - len(i['security']) + 1 :] # Add the new hotspot to the message - msg = '{:{width}} {security}'.format(nativestr(hotspot_name), - width=if_name_max_width - len(i['security']) - 1, - security=i['security']) + msg = '{:{width}} {security}'.format( + nativestr(hotspot_name), width=if_name_max_width - len(i['security']) - 1, security=i['security'] + ) ret.append(self.curse_add_line(msg)) msg = '{:>7}'.format( i['signal'], @@ -244,12 +245,7 @@ class ThreadHotspot(threading.Thread): if len(h) != 4 or h[0] != 'yes': # Do not process the line if it is not the active hotspot continue - nmcli_result.append({ - 'key': 'ssid', - 'ssid': h[1], - 'signal': -float(h[2]), - 'security': h[3] - }) + nmcli_result.append({'key': 'ssid', 'ssid': h[1], 'signal': -float(h[2]), 'security': h[3]}) self.thread_stats = nmcli_result # Wait refresh time until next scan # Note: nmcli cache the result for x seconds diff --git a/unitest-restful.py b/unitest-restful.py index a697ff78..17e734e1 100755 --- a/unitest-restful.py +++ b/unitest-restful.py @@ -231,6 +231,18 @@ class TestGlances(unittest.TestCase): self.assertTrue(req.ok) self.assertEqual(req.text, "Active") + def test_013_top(self): + """Values.""" + method = "processlist" + request = "%s/%s/top/2" % (URL, method) + print('INFO: [TEST_013] Top nb item of PROCESSLIST') + print(request) + req = self.http_get(request) + + self.assertTrue(req.ok) + self.assertIsInstance(req.json(), list) + self.assertEqual(len(req.json()), 2) + def test_999_stop_server(self): """Stop the Glances Web Server.""" print('INFO: [TEST_999] Stop the Glances Web Server') From a4d247b52ca4021884e5b3590d5ddefb6cedfb5f Mon Sep 17 00:00:00 2001 From: nicolargo Date: Mon, 14 Aug 2023 10:31:07 +0200 Subject: [PATCH 002/126] Update docs --- docs/api.rst | 355 +++++++++++++++++++++++---------------------- docs/man/glances.1 | 2 +- 2 files changed, 186 insertions(+), 171 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 04d51eb5..56921a56 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -84,14 +84,14 @@ GET alert Get plugin stats:: # curl http://localhost:61208/api/3/alert - [[1690293736.0, + [[1692001850.0, -1, "WARNING", "MEM", - 77.54053433873582, - 77.54053433873582, - 77.54053433873582, - 77.54053433873582, + 86.74449323293155, + 86.74449323293155, + 86.74449323293155, + 86.74449323293155, 1, [], "", @@ -111,7 +111,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.23587393760681152}, + "timer": 0.3125603199005127}, {"count": 0, "countmax": 20.0, "countmin": None, @@ -120,7 +120,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.2357802391052246}] + "timer": 0.31241464614868164}] Get a specific field:: @@ -138,7 +138,7 @@ Get a specific item when field matches the given value:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.23587393760681152}]} + "timer": 0.3125603199005127}]} GET connections --------------- @@ -164,66 +164,20 @@ Get plugin stats:: "Id": "3abd51c615968482d9ccff5afc629f267f6dda113ed68b75b432615fae3b49fb", "Image": ["portainer/portainer-ce:2.9.3"], "Status": "running", - "Uptime": "an hour", + "Uptime": "1 weeks", "cpu": {"total": 0.0}, "cpu_percent": 0.0, "engine": "docker", - "io": {"cumulative_ior": 29429760, "cumulative_iow": 2326528}, + "io": {}, "io_r": None, "io_w": None, "key": "name", - "memory": {"cache": None, - "limit": 7836184576, - "max_usage": None, - "rss": None, - "usage": 21876736}, - "memory_usage": 21876736, + "memory": {}, + "memory_usage": None, "name": "portainer", - "network": {"cumulative_rx": 401604, "cumulative_tx": 0}, + "network": {}, "network_rx": None, - "network_tx": None}, - {"Command": ["top"], - "Created": "2023-05-08T15:29:34.918692365+02:00", - "Id": "4b7f732d43e4bc5d92fe5298cba025b550e6a608754c1c38f9a90aaecd46b8f9", - "Image": "["docker.io/library/ubuntu:latest"]", - "Status": "running", - "Uptime": "2 months", - "cpu": {"total": 6.7650116939635326e-06}, - "cpu_percent": 6.7650116939635326e-06, - "engine": "podman", - "io": {"ior": 0.0, "iow": 0.0, "time_since_update": 1}, - "io_r": 0.0, - "io_w": 0.0, - "key": "name", - "memory": {"limit": 7836184576.0, "usage": 1093632.0}, - "memory_usage": 1093632.0, - "name": "frosty_bouman", - "network": {"rx": 0.0, "time_since_update": 1, "tx": 0.0}, - "network_rx": 0.0, - "network_tx": 0.0, - "pod_id": "8d0f1c783def", - "pod_name": "frosty_bouman"}, - {"Command": [], - "Created": "2022-10-22T14:23:03.120912374+02:00", - "Id": "9491515251edcd5bb5dc17205d7ee573c0be96fe0b08b0a12a7e2cea874565ea", - "Image": "["k8s.gcr.io/pause:3.5"]", - "Status": "running", - "Uptime": "2 months", - "cpu": {"total": 3.177554220933258e-10}, - "cpu_percent": 3.177554220933258e-10, - "engine": "podman", - "io": {"ior": 0.0, "iow": 0.0, "time_since_update": 1}, - "io_r": 0.0, - "io_w": 0.0, - "key": "name", - "memory": {"limit": 7836184576.0, "usage": 204800.0}, - "memory_usage": 204800.0, - "name": "8d0f1c783def-infra", - "network": {"rx": 0.0, "time_since_update": 1, "tx": 0.0}, - "network_rx": 0.0, - "network_tx": 0.0, - "pod_id": "8d0f1c783def", - "pod_name": "8d0f1c783def-infra"}], + "network_tx": None}], "version": {}, "version_podman": {}} @@ -255,19 +209,19 @@ Get plugin stats:: "ctx_switches": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 70.8, + "idle": 58.6, "interrupts": 0, - "iowait": 0.0, + "iowait": 0.9, "irq": 0.0, - "nice": 0.0, + "nice": 0.5, "soft_interrupts": 0, - "softirq": 0.7, + "softirq": 0.0, "steal": 0.0, "syscalls": 0, - "system": 4.4, + "system": 10.9, "time_since_update": 1, - "total": 29.2, - "user": 24.1} + "total": 40.5, + "user": 29.1} Fields descriptions: @@ -290,7 +244,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/cpu/total - {"total": 29.2} + {"total": 40.5} GET diskio ---------- @@ -336,13 +290,13 @@ Get plugin stats:: # curl http://localhost:61208/api/3/fs [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 25133506560, + "free": 22384226304, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 89.1, + "percent": 90.3, "size": 243334156288, - "used": 205813194752}, + "used": 208562475008}, {"device_name": "zsfpool", "free": 41811968, "fs_type": "zfs", @@ -361,13 +315,13 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/3/fs/mnt_point// {"/": [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 25133506560, + "free": 22384226304, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 89.1, + "percent": 90.3, "size": 243334156288, - "used": 205813194752}]} + "used": 208562475008}]} GET ip ------ @@ -393,10 +347,7 @@ GET load Get plugin stats:: # curl http://localhost:61208/api/3/load - {"cpucore": 4, - "min1": 1.18505859375, - "min15": 1.17724609375, - "min5": 1.23779296875} + {"cpucore": 4, "min1": 1.71875, "min15": 1.73095703125, "min5": 1.798828125} Fields descriptions: @@ -408,7 +359,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/load/min1 - {"min1": 1.18505859375} + {"min1": 1.71875} GET mem ------- @@ -416,16 +367,16 @@ GET mem Get plugin stats:: # curl http://localhost:61208/api/3/mem - {"active": 3179450368, - "available": 1759965184, - "buffers": 139554816, - "cached": 2369826816, - "free": 1759965184, - "inactive": 3354943488, - "percent": 77.5, - "shared": 580452352, - "total": 7836184576, - "used": 6076219392} + {"active": 1974509568, + "available": 1037058048, + "buffers": 55336960, + "cached": 1280933888, + "free": 1037058048, + "inactive": 2258354176, + "percent": 86.7, + "shared": 444837888, + "total": 7823601664, + "used": 6786543616} Fields descriptions: @@ -444,7 +395,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/mem/total - {"total": 7836184576} + {"total": 7823601664} GET memswap ----------- @@ -452,13 +403,13 @@ GET memswap Get plugin stats:: # curl http://localhost:61208/api/3/memswap - {"free": 5171486720, - "percent": 36.0, - "sin": 30833557504, - "sout": 44998725632, + {"free": 5001969664, + "percent": 38.1, + "sin": 2162475008, + "sout": 4830765056, "time_since_update": 1, "total": 8082419712, - "used": 2910932992} + "used": 3080450048} Fields descriptions: @@ -482,29 +433,29 @@ Get plugin stats:: # curl http://localhost:61208/api/3/network [{"alias": None, - "cumulative_cx": 1271814348, - "cumulative_rx": 635907174, - "cumulative_tx": 635907174, - "cx": 1070, + "cumulative_cx": 1113168746, + "cumulative_rx": 556584373, + "cumulative_tx": 556584373, + "cx": 0, "interface_name": "lo", "is_up": True, "key": "interface_name", - "rx": 535, + "rx": 0, "speed": 0, "time_since_update": 1, - "tx": 535}, + "tx": 0}, {"alias": None, - "cumulative_cx": 43280474609, - "cumulative_rx": 41602144558, - "cumulative_tx": 1678330051, - "cx": 4727, + "cumulative_cx": 8311348554, + "cumulative_rx": 8123752443, + "cumulative_tx": 187596111, + "cx": 224, "interface_name": "wlp2s0", "is_up": True, "key": "interface_name", - "rx": 663, + "rx": 98, "speed": 0, "time_since_update": 1, - "tx": 4064}] + "tx": 126}] Fields descriptions: @@ -525,27 +476,27 @@ Get a specific field:: # curl http://localhost:61208/api/3/network/interface_name {"interface_name": ["lo", "wlp2s0", - "docker0", "br_grafana", + "docker0", + "veth0ada394", "mpqemubr0", - "veth0868fe1", "vboxnet0"]} Get a specific item when field matches the given value:: # curl http://localhost:61208/api/3/network/interface_name/lo {"lo": [{"alias": None, - "cumulative_cx": 1271814348, - "cumulative_rx": 635907174, - "cumulative_tx": 635907174, - "cx": 1070, + "cumulative_cx": 1113168746, + "cumulative_rx": 556584373, + "cumulative_tx": 556584373, + "cx": 0, "interface_name": "lo", "is_up": True, "key": "interface_name", - "rx": 535, + "rx": 0, "speed": 0, "time_since_update": 1, - "tx": 535}]} + "tx": 0}]} GET now ------- @@ -553,7 +504,7 @@ GET now Get plugin stats:: # curl http://localhost:61208/api/3/now - "2023-07-25 16:02:16 CEST" + "2023-08-14 10:30:50 CEST" GET percpu ---------- @@ -564,29 +515,29 @@ Get plugin stats:: [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 30.0, + "idle": 32.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 2.0, - "total": 70.0, - "user": 4.0}, + "system": 8.0, + "total": 68.0, + "user": 14.0}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 30.0, + "idle": 37.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", - "nice": 0.0, + "nice": 1.0, "softirq": 0.0, "steal": 0.0, - "system": 0.0, - "total": 70.0, - "user": 4.0}] + "system": 6.0, + "total": 63.0, + "user": 11.0}] Get a specific field:: @@ -605,7 +556,7 @@ Get plugin stats:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.005154, + "status": 0.006752, "timeout": 3}] Get a specific field:: @@ -622,7 +573,7 @@ Get a specific item when field matches the given value:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.005154, + "status": 0.006752, "timeout": 3}]} GET processcount @@ -631,12 +582,12 @@ GET processcount Get plugin stats:: # curl http://localhost:61208/api/3/processcount - {"pid_max": 0, "running": 1, "sleeping": 323, "thread": 1643, "total": 391} + {"pid_max": 0, "running": 1, "sleeping": 309, "thread": 1606, "total": 377} Get a specific field:: # curl http://localhost:61208/api/3/processcount/total - {"total": 391} + {"total": 377} GET psutilversion ----------------- @@ -652,69 +603,69 @@ GET quicklook Get plugin stats:: # curl http://localhost:61208/api/3/quicklook - {"cpu": 29.2, - "cpu_hz": 3000000000.0, - "cpu_hz_current": 2649443250.0, + {"cpu": 40.5, + "cpu_hz": 2025000000.0, + "cpu_hz_current": 2048946250.0, "cpu_name": "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz", - "mem": 77.5, + "mem": 86.7, "percpu": [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 30.0, + "idle": 32.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 2.0, - "total": 70.0, - "user": 4.0}, + "system": 8.0, + "total": 68.0, + "user": 14.0}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 30.0, + "idle": 37.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", - "nice": 0.0, + "nice": 1.0, "softirq": 0.0, "steal": 0.0, - "system": 0.0, - "total": 70.0, - "user": 4.0}, + "system": 6.0, + "total": 63.0, + "user": 11.0}, {"cpu_number": 2, "guest": 0.0, "guest_nice": 0.0, - "idle": 14.0, + "idle": 29.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 3.0, - "total": 86.0, + "system": 8.0, + "total": 71.0, "user": 17.0}, {"cpu_number": 3, "guest": 0.0, "guest_nice": 0.0, - "idle": 24.0, - "iowait": 0.0, + "idle": 30.0, + "iowait": 1.0, "irq": 0.0, "key": "cpu_number", - "nice": 0.0, - "softirq": 1.0, + "nice": 1.0, + "softirq": 0.0, "steal": 0.0, "system": 2.0, - "total": 76.0, - "user": 9.0}], - "swap": 36.0} + "total": 70.0, + "user": 22.0}], + "swap": 38.1} Get a specific field:: # curl http://localhost:61208/api/3/quicklook/cpu - {"cpu": 29.2} + {"cpu": 40.5} GET sensors ----------- @@ -771,7 +722,7 @@ Get plugin stats:: "hr_name": "Ubuntu 22.04 64bit", "linux_distro": "Ubuntu 22.04", "os_name": "Linux", - "os_version": "5.15.0-71-generic", + "os_version": "5.15.0-78-generic", "platform": "64bit"} Get a specific field:: @@ -785,7 +736,7 @@ GET uptime Get plugin stats:: # curl http://localhost:61208/api/3/uptime - "78 days, 3:00:11" + "7 days, 23:04:48" GET all stats ------------- @@ -795,39 +746,103 @@ Get all Glances stats:: # curl http://localhost:61208/api/3/all Return a very big dictionary (avoid using this request, performances will be poor)... +GET top n items of a specific plugin +------------------------------------ + +Get top 2 processes of the processlist plugin:: + + # curl http://localhost:61208/api/3/processlist/top/2 + [{"cmdline": ["/usr/lib/virtualbox/VBoxHeadless", + "--comment", + "minikube", + "--startvm", + "3aa18a3e-08d7-418b-9d17-ecf2f6079bbd", + "--vrde", + "config"], + "cpu_percent": 0.0, + "cpu_times": pcputimes(user=183.52, system=2738.49, children_user=0.0, children_system=0.0, iowait=0.0), + "gids": pgids(real=1000, effective=1000, saved=1000), + "io_counters": [0, 0, 0, 0, 0], + "key": "pid", + "memory_info": pmem(rss=2335199232, vms=4198170624, shared=2333605888, text=40960, lib=0, data=87470080, dirty=0), + "memory_percent": 29.848135581152206, + "name": "VBoxHeadless", + "nice": 0, + "num_threads": 28, + "pid": 81109, + "status": "S", + "time_since_update": 1, + "username": "nicolargo"}, + {"cmdline": ["/snap/firefox/2908/usr/lib/firefox/firefox", + "-contentproc", + "-childID", + "1", + "-isForBrowser", + "-prefsLen", + "33570", + "-prefMapSize", + "245480", + "-jsInitLen", + "240908", + "-parentBuildID", + "20230710222611", + "-appDir", + "/snap/firefox/2908/usr/lib/firefox/browser", + "{0ad13ab1-9130-48f6-a388-06a571221c5c}", + "6490", + "true", + "tab"], + "cpu_percent": 0.0, + "cpu_times": pcputimes(user=637.59, system=77.54, children_user=0.0, children_system=0.0, iowait=0.0), + "gids": pgids(real=1000, effective=1000, saved=1000), + "io_counters": [581462016, 0, 0, 0, 0], + "key": "pid", + "memory_info": pmem(rss=427667456, vms=3597381632, shared=27496448, text=643072, lib=0, data=1006702592, dirty=0), + "memory_percent": 5.466375645987899, + "name": "WebExtensions", + "nice": 0, + "num_threads": 20, + "pid": 6903, + "status": "S", + "time_since_update": 1, + "username": "nicolargo"}] + +Note: Only work for plugin with a list of items + GET stats history ----------------- History of a plugin:: # curl http://localhost:61208/api/3/cpu/history - {"system": [["2023-07-25T16:02:16.701846", 4.4], - ["2023-07-25T16:02:18.501052", 4.4], - ["2023-07-25T16:02:19.527073", 3.0]], - "user": [["2023-07-25T16:02:16.701836", 24.1], - ["2023-07-25T16:02:18.501045", 24.1], - ["2023-07-25T16:02:19.527068", 16.6]]} + {"system": [["2023-08-14T10:30:51.996947", 10.9], + ["2023-08-14T10:30:53.034098", 12.8], + ["2023-08-14T10:30:54.245612", 12.8]], + "user": [["2023-08-14T10:30:51.996926", 29.1], + ["2023-08-14T10:30:53.034088", 13.3], + ["2023-08-14T10:30:54.245590", 13.3]]} Limit history to last 2 values:: # curl http://localhost:61208/api/3/cpu/history/2 - {"system": [["2023-07-25T16:02:18.501052", 4.4], - ["2023-07-25T16:02:19.527073", 3.0]], - "user": [["2023-07-25T16:02:18.501045", 24.1], - ["2023-07-25T16:02:19.527068", 16.6]]} + {"system": [["2023-08-14T10:30:53.034098", 12.8], + ["2023-08-14T10:30:54.245612", 12.8]], + "user": [["2023-08-14T10:30:53.034088", 13.3], + ["2023-08-14T10:30:54.245590", 13.3]]} History for a specific field:: # curl http://localhost:61208/api/3/cpu/system/history - {"system": [["2023-07-25T16:02:16.701846", 4.4], - ["2023-07-25T16:02:18.501052", 4.4], - ["2023-07-25T16:02:19.527073", 3.0]]} + {"system": [["2023-08-14T10:30:50.142286", 10.9], + ["2023-08-14T10:30:51.996947", 10.9], + ["2023-08-14T10:30:53.034098", 12.8], + ["2023-08-14T10:30:54.245612", 12.8]]} Limit history for a specific field to last 2 values:: # curl http://localhost:61208/api/3/cpu/system/history - {"system": [["2023-07-25T16:02:18.501052", 4.4], - ["2023-07-25T16:02:19.527073", 3.0]]} + {"system": [["2023-08-14T10:30:53.034098", 12.8], + ["2023-08-14T10:30:54.245612", 12.8]]} GET limits (used for thresholds) -------------------------------- diff --git a/docs/man/glances.1 b/docs/man/glances.1 index 6e90746c..62d39203 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" "Jul 25, 2023" "4.0.0_beta01" "Glances" +.TH "GLANCES" "1" "Aug 14, 2023" "4.0.0_beta01" "Glances" .SH NAME glances \- An eye on your system .SH SYNOPSIS From 99d05fdd6397f3b8bee76860ebee8bf107ae93f7 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Mon, 14 Aug 2023 10:50:47 +0200 Subject: [PATCH 003/126] Update README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 98f4f70a..01405fa3 100644 --- a/README.rst +++ b/README.rst @@ -252,7 +252,7 @@ GNU/Linux `Glances` is available on many Linux distributions, so you should be able to install it using your favorite package manager. Be aware that when you use this method the operating system `package`_ for `Glances` -may not be the latest version. +may not be the latest version and only basics plugins are enabled. Note: The Debian package (and all other Debian-based distributions) do not include anymore the JS statics files used by the Web interface From e70f2762beec89d2e9330df2a43f7daf39f463d2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 21:47:51 +0000 Subject: [PATCH 004/126] chore(deps): update dependency zeroconf to v0.80.0 --- optional-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optional-requirements.txt b/optional-requirements.txt index 29dc44a7..709be07c 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -35,5 +35,5 @@ six sparklines statsd wifi -zeroconf==0.74.0; python_version < "3.7" +zeroconf==0.80.0; python_version < "3.7" zeroconf; python_version >= "3.7" From d11ddde2a09253accc04041d0761ff15e3003f3c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 19 Aug 2023 02:00:37 +0000 Subject: [PATCH 005/126] chore(deps): update dependency sass to v1.66.1 --- glances/outputs/static/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/glances/outputs/static/package-lock.json b/glances/outputs/static/package-lock.json index cea69772..209c565a 100644 --- a/glances/outputs/static/package-lock.json +++ b/glances/outputs/static/package-lock.json @@ -4497,9 +4497,9 @@ } }, "node_modules/sass": { - "version": "1.65.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.65.1.tgz", - "integrity": "sha512-9DINwtHmA41SEd36eVPQ9BJKpn7eKDQmUHmpI0y5Zv2Rcorrh0zS+cFrt050hdNbmmCNKTW3hV5mWfuegNRsEA==", + "version": "1.66.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.66.1.tgz", + "integrity": "sha512-50c+zTsZOJVgFfTgwwEzkjA3/QACgdNsKueWPyAR0mRINIvLAStVQBbPg14iuqEQ74NPDbXzJARJ/O4SI1zftA==", "dev": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0", @@ -9124,9 +9124,9 @@ } }, "sass": { - "version": "1.65.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.65.1.tgz", - "integrity": "sha512-9DINwtHmA41SEd36eVPQ9BJKpn7eKDQmUHmpI0y5Zv2Rcorrh0zS+cFrt050hdNbmmCNKTW3hV5mWfuegNRsEA==", + "version": "1.66.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.66.1.tgz", + "integrity": "sha512-50c+zTsZOJVgFfTgwwEzkjA3/QACgdNsKueWPyAR0mRINIvLAStVQBbPg14iuqEQ74NPDbXzJARJ/O4SI1zftA==", "dev": true, "requires": { "chokidar": ">=3.0.0 <4.0.0", From 8f57fd36127a1586b36a26a43de701021ef09913 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 19 Aug 2023 11:06:32 +0200 Subject: [PATCH 006/126] Manage error while scanning folder --- glances/folder_list.py | 58 ++++++------------------------- glances/globals.py | 26 ++++++++++++++ glances/outputs/glances_curses.py | 1 + glances/plugins/folders/model.py | 12 +++---- setup.py | 5 ++- 5 files changed, 46 insertions(+), 56 deletions(-) diff --git a/glances/folder_list.py b/glances/folder_list.py index 135531d2..2dccab93 100644 --- a/glances/folder_list.py +++ b/glances/folder_list.py @@ -13,22 +13,9 @@ from __future__ import unicode_literals import os from glances.timer import Timer -from glances.globals import nativestr +from glances.globals import nativestr, folder_size from glances.logger import logger -# Use the built-in version of scandir/walk if possible, otherwise -# use the scandir module version -scandir_tag = True -try: - # For Python 3.5 or higher - from os import scandir -except ImportError: - # For others... - try: - from scandir import scandir - except ImportError: - scandir_tag = False - class FolderList(object): @@ -62,12 +49,9 @@ class FolderList(object): self.first_grab = True if self.config is not None and self.config.has_section('folders'): - if scandir_tag: - # Process monitoring list - logger.debug("Folder list configuration detected") - self.__set_folder_list('folders') - else: - logger.error('Scandir not found. Please use Python 3.5+ or install the scandir lib') + # Process monitoring list + logger.debug("Folder list configuration detected") + self.__set_folder_list('folders') else: self.__folder_list = [] @@ -132,23 +116,6 @@ class FolderList(object): else: return None - def __folder_size(self, path): - """Return the size of the directory given by path - - path: """ - - ret = 0 - for f in scandir(path): - if f.is_dir(follow_symlinks=False) and (f.name != '.' or f.name != '..'): - ret += self.__folder_size(os.path.join(path, f.name)) - else: - try: - ret += f.stat().st_size - except OSError: - pass - - return ret - def update(self, key='path'): """Update the command result attributed.""" # Only continue if monitor list is not empty @@ -163,16 +130,13 @@ class FolderList(object): # Set the key (see issue #2327) self.__folder_list[i]['key'] = key # Get folder size - try: - self.__folder_list[i]['size'] = self.__folder_size(self.path(i)) - except OSError as e: - logger.debug('Cannot get folder size ({}). Error: {}'.format(self.path(i), e)) - if e.errno == 13: - # Permission denied - self.__folder_list[i]['size'] = '!' - else: - self.__folder_list[i]['size'] = '?' - # Reset the timer + self.__folder_list[i]['size'], self.__folder_list[i]['errno'] = folder_size(self.path(i)) + if self.__folder_list[i]['errno'] != 0: + logger.debug('Folder size ({} ~ {}) may not be correct. Error: {}'.format( + self.path(i), + self.__folder_list[i]['size'], + self.__folder_list[i]['errno'])) + # Reset the timer self.timer_folders[i].reset() # It is no more the first time... diff --git a/glances/globals.py b/glances/globals.py index c539c9b5..87a48817 100644 --- a/glances/globals.py +++ b/glances/globals.py @@ -372,3 +372,29 @@ def string_value_to_float(s): def file_exists(filename): """Return True if the file exists and is readable.""" return os.path.isfile(filename) and os.access(filename, os.R_OK) + + +def folder_size(path, errno=0): + """Return a tuple with the size of the directory given by path and the errno. + If an error occurs (for example one file or subfolder is not accessible), + errno is set to the error number. + + path: + errno: Should always be 0 when calling the function""" + ret_size = 0 + ret_err = errno + try: + f_list = os.scandir(path) + except OSError as e: + return 0, e.errno + for f in f_list: + if f.is_dir(follow_symlinks=False) and (f.name != '.' or f.name != '..'): + ret = folder_size(os.path.join(path, f.name), ret_err) + ret_size += ret[0] + ret_err = ret[1] + else: + try: + ret_size += f.stat().st_size + except OSError as e: + ret_err = e.errno + return ret_size, ret_err diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index d598e393..2fd00f01 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -330,6 +330,7 @@ class _GlancesCurses(object): 'PASSWORD': curses.A_PROTECT, 'SELECTED': self.selected_color, 'INFO': self.ifINFO_color, + 'ERROR': self.selected_color, } def set_cursor(self, value): diff --git a/glances/plugins/folders/model.py b/glances/plugins/folders/model.py index e1d8328b..7c5a098e 100644 --- a/glances/plugins/folders/model.py +++ b/glances/plugins/folders/model.py @@ -64,8 +64,8 @@ class PluginModel(GlancesPluginModel): def get_alert(self, stat, header=""): """Manage limits of the folder list.""" - if not isinstance(stat['size'], numbers.Number): - ret = 'DEFAULT' + if stat['errno'] != 0: + ret = 'ERROR' else: ret = 'OK' @@ -108,15 +108,15 @@ class PluginModel(GlancesPluginModel): ret.append(self.curse_new_line()) if len(i['path']) > name_max_width: # Cut path if it is too long - path = '_' + i['path'][-name_max_width + 1 :] + path = '_' + i['path'][-name_max_width + 1:] else: path = i['path'] msg = '{:{width}}'.format(nativestr(path), width=name_max_width) ret.append(self.curse_add_line(msg)) - try: + if i['errno'] != 0: + msg = '?{:>8}'.format(self.auto_unit(i['size'])) + else: msg = '{:>9}'.format(self.auto_unit(i['size'])) - except (TypeError, ValueError): - msg = '{:>9}'.format(i['size']) ret.append(self.curse_add_line(msg, self.get_alert(i, header='folder_' + i['indice']))) return ret diff --git a/setup.py b/setup.py index bb923f01..917e6cdc 100755 --- a/setup.py +++ b/setup.py @@ -9,8 +9,8 @@ from io import open from setuptools import setup, Command -if sys.version_info < (3, 4): - print('Glances requires at least Python 3.4 to run.') +if sys.version_info < (3, 8): + print('Glances requires at least Python 3.8 to run.') sys.exit(1) # Global functions @@ -60,7 +60,6 @@ def get_install_extras_require(): 'graphitesender', 'influxdb>=1.0.0', 'influxdb-client', 'pymongo', 'kafka-python', 'pika', 'paho-mqtt', 'potsdb', 'prometheus_client', 'pyzmq', 'statsd'], - 'folders': ['scandir'], 'gpu': ['py3nvml'], 'graph': ['pygal'], 'ip': ['netifaces'], From 990abccf9a3ccd7a090bbb01da40628bb5c6d639 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 19 Aug 2023 17:51:28 +0200 Subject: [PATCH 007/126] Folders plugin always fails on special directories #2518 --- glances/outputs/static/css/style.scss | 4 ++++ .../static/js/components/plugin-folders.vue | 8 ++++++-- glances/outputs/static/public/glances.js | Bin 448339 -> 448470 bytes 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/glances/outputs/static/css/style.scss b/glances/outputs/static/css/style.scss index 2feafa6f..40c8c150 100644 --- a/glances/outputs/static/css/style.scss +++ b/glances/outputs/static/css/style.scss @@ -110,6 +110,10 @@ body { color: white; font-weight: bold; } +.error { + color: #EE6600; + font-weight: bold; +} /* Plugins */ #processlist-plugin .table-cell { diff --git a/glances/outputs/static/js/components/plugin-folders.vue b/glances/outputs/static/js/components/plugin-folders.vue index 7e6f704b..7422229e 100644 --- a/glances/outputs/static/js/components/plugin-folders.vue +++ b/glances/outputs/static/js/components/plugin-folders.vue @@ -9,6 +9,9 @@
{{ folder.path }}
+ + ? + {{ $filters.bytes(folder.size) }}
@@ -31,6 +34,7 @@ export default { return { path: folderData['path'], size: folderData['size'], + errno: folderData['errno'], careful: folderData['careful'], warning: folderData['warning'], critical: folderData['critical'] @@ -40,8 +44,8 @@ export default { }, methods: { getDecoration(folder) { - if (!Number.isInteger(folder.size)) { - return; + if (folder.errno > 0) { + return 'error'; } if (folder.critical !== null && folder.size > folder.critical * 1000000) { return 'critical'; diff --git a/glances/outputs/static/public/glances.js b/glances/outputs/static/public/glances.js index 891999b957350b543ee58ea93efd769cb59cacff..eebe9c505715845134791506d239ff8e210494db 100644 GIT binary patch delta 7395 zcmZu$33wD$w*GF>bpnBI2-zS&NSX%Iq_UwbHU`L^kbNgXz)pAdLVBt6lBF?%Ac{JU z;KFf1lo6LfkWH+o^PbBa9iKWNJm-6S`i<-8sN?5ze2ni2j`~hjb<#zYe5CHZ=bU@a z`R_UBo~pe4^ql`XI_KCICsGQ; zCih*ug2nEB>7tE(e}C}+tvqz8fPTMusgQnOy5yZ36Z6fh&G~Kgpr3Af=dW)N zh1lI&zqcBQp^FCTGvl0HW1K?l_b7Ji$|ti(yNIDxL(!vZ@M4DH}*%h zmqC)N)-Vql@WdKc$6+5W$v&G(ObK+8^&AuN zgB@%;@%G)s(k7Ga(65+#>U2x6wA-6k7P1O4WrQCcVwtkxK9)X}jBPzgyA?dj>UHDg z`1?oM0rFBj$QIHzw;yEb3cv>*XIEv!?0FHZEn*$DT35QF0Y}6e3=lA1KF*#8E~f2{ zFC1Z6&#+9q;~Y!f`wB~v z-+G3fQ6Sj=JN63MEIVFff1WhcVprH5cF7yD`@Au+G$yyc$s!7{e>lSqv8k4z!r+b& z1-G1Ke<6o9onzaG{^2?HLK1EC@H=c3h3?Mxxt;G%I`zK6^}5Lt75YXZV%U~vEnO9p z+uksIKo;VXw+zckaPwP+lo=#={Rf6EoXH}Vc8htrB|>g7VJq_=8`exB-s(>ceEJU)5bHO8EiD2^10!K8S`S1JW+@U0qbZ;j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 zf>Qg=ni`S99-lZeG9uV@#=SA)HvISy%;O?40}}^5P7lSV!>7xhPG2lGhhCrnlIX>U zsx8hdiY;pdB^mO0hfko@Q)BiG8J1GH zIq?-}Qx=cjh~~+6yaF4O>3 Date: Sat, 19 Aug 2023 17:55:21 +0200 Subject: [PATCH 008/126] Minimum Python version is 3.8 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f770fb6..a62af7df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: From da4763da5942d7e2a908b78a125f657e9ef92b5d Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 19 Aug 2023 17:57:25 +0200 Subject: [PATCH 009/126] Minimum Python version is 3.8 (also for Windows) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a62af7df..a9427165 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -64,7 +64,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: From 621b83b6c92829a5076bda8292319c0c23715de1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Aug 2023 18:28:54 +0000 Subject: [PATCH 010/126] chore(deps): update dependency del to v7.1.0 --- glances/outputs/static/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/glances/outputs/static/package-lock.json b/glances/outputs/static/package-lock.json index 209c565a..51285aa0 100644 --- a/glances/outputs/static/package-lock.json +++ b/glances/outputs/static/package-lock.json @@ -1605,9 +1605,9 @@ } }, "node_modules/del": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/del/-/del-7.0.0.tgz", - "integrity": "sha512-tQbV/4u5WVB8HMJr08pgw0b6nG4RGt/tj+7Numvq+zqcvUFeMaIWWOUFltiU+6go8BSO2/ogsB4EasDaj0y68Q==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/del/-/del-7.1.0.tgz", + "integrity": "sha512-v2KyNk7efxhlyHpjEvfyxaAihKKK0nWCuf6ZtqZcFFpQRG0bJ12Qsr0RpvsICMjAAZ8DOVCxrlqpxISlMHC4Kg==", "dev": true, "dependencies": { "globby": "^13.1.2", @@ -7008,9 +7008,9 @@ "dev": true }, "del": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/del/-/del-7.0.0.tgz", - "integrity": "sha512-tQbV/4u5WVB8HMJr08pgw0b6nG4RGt/tj+7Numvq+zqcvUFeMaIWWOUFltiU+6go8BSO2/ogsB4EasDaj0y68Q==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/del/-/del-7.1.0.tgz", + "integrity": "sha512-v2KyNk7efxhlyHpjEvfyxaAihKKK0nWCuf6ZtqZcFFpQRG0bJ12Qsr0RpvsICMjAAZ8DOVCxrlqpxISlMHC4Kg==", "dev": true, "requires": { "globby": "^13.1.2", From 2fcaa74924361cc79f9dcdbe915f370bf0f4d044 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 14:43:42 +0000 Subject: [PATCH 011/126] chore(deps): update actions/checkout action to v4 --- .github/workflows/build.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/test.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be17203f..3ae9f4d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install pip install build tools run: >- @@ -101,7 +101,7 @@ jobs: tag: ${{ fromJson(needs.create_Docker_builds.outputs.tags) }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Retrieve Repository Docker metadata id: docker_meta diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d3237f44..143d5183 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,7 +39,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9427165..6d1465e3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 @@ -68,7 +68,7 @@ jobs: steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 From 3b6a4331c2100c064d8907df2b9c89b13689d93b Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 9 Sep 2023 16:46:19 +0200 Subject: [PATCH 012/126] By default graph should not be generated every 60 seconds... --- conf/glances.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/glances.conf b/conf/glances.conf index 0fdf4651..19fbbee6 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -466,7 +466,7 @@ path=/tmp # It is possible to generate the graphs automatically by setting the # generate_every to a non zero value corresponding to the seconds between # two generation. Set it to 0 to disable graph auto generation. -generate_every=60 +generate_every=0 # See following configuration keys definitions in the Pygal lib documentation # http://pygal.org/en/stable/documentation/index.html width=800 From 9211b394384542c55e33e8671675b692e8d0d43a Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 9 Sep 2023 16:48:08 +0200 Subject: [PATCH 013/126] By default graph should be generated every 60 seconds if the --export-graph option is used... --- conf/glances.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/glances.conf b/conf/glances.conf index 19fbbee6..0fdf4651 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -466,7 +466,7 @@ path=/tmp # It is possible to generate the graphs automatically by setting the # generate_every to a non zero value corresponding to the seconds between # two generation. Set it to 0 to disable graph auto generation. -generate_every=0 +generate_every=60 # See following configuration keys definitions in the Pygal lib documentation # http://pygal.org/en/stable/documentation/index.html width=800 From 8b3bb67405126e12acc1452791c416582f3b6317 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 08:54:09 +0000 Subject: [PATCH 014/126] chore(deps): update crazy-max/ghaction-docker-meta action to v5 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be17203f..7df21a4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -105,7 +105,7 @@ jobs: - name: Retrieve Repository Docker metadata id: docker_meta - uses: crazy-max/ghaction-docker-meta@v4.6.0 + uses: crazy-max/ghaction-docker-meta@v5.0.0 with: images: ${{ env.DEFAULT_DOCKER_IMAGE }} labels: | From c179f25248f91924a8cba1039ded3b3d0afaa943 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 08:54:14 +0000 Subject: [PATCH 015/126] chore(deps): update docker/build-push-action action to v5 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be17203f..8b1da772 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -137,7 +137,7 @@ jobs: password: ${{ secrets.DOCKER_TOKEN }} - name: Build and push image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: push: ${{ env.PUSH_BRANCH == 'true' }} tags: "${{ env.DEFAULT_DOCKER_IMAGE }}:${{ matrix.os != 'alpine' && format('{0}-', matrix.os) || '' }}${{ matrix.tag.tag }}" From 496c96879c6a2be576a6b5e43d52a66de5b9b92f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 11:58:09 +0000 Subject: [PATCH 016/126] chore(deps): update docker/login-action action to v3 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be17203f..c7c553e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -130,7 +130,7 @@ jobs: version: latest - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 if: ${{ env.PUSH_BRANCH == 'true' }} with: username: ${{ secrets.DOCKER_USERNAME }} From 33c90e06906a4c44e52eb9787f4968509d68c438 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 11:58:13 +0000 Subject: [PATCH 017/126] chore(deps): update docker/setup-buildx-action action to v3 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be17203f..03088437 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -125,7 +125,7 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 with: version: latest From c5ac644fe48b0331c508bad991223b744eb7eb62 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 14:09:31 +0000 Subject: [PATCH 018/126] chore(deps): update docker/setup-qemu-action action to v3 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be17203f..1f3c278e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -119,7 +119,7 @@ jobs: restore-keys: ${{ runner.os }}-buildx-${{ env.NODE_ENV }}-${{ matrix.os }} - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 with: platforms: all From 16fa5c3b5b9f02c854e43f5a80e902118bf330e2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:02:39 +0000 Subject: [PATCH 019/126] chore(deps): update dependency zeroconf to v0.112.0 --- optional-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optional-requirements.txt b/optional-requirements.txt index 709be07c..d53ef338 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -35,5 +35,5 @@ six sparklines statsd wifi -zeroconf==0.80.0; python_version < "3.7" +zeroconf==0.112.0; python_version < "3.7" zeroconf; python_version >= "3.7" From 240ac4ee4b5a221257f88ead0d41db8bed6efcf2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 22 Sep 2023 21:15:59 +0000 Subject: [PATCH 020/126] chore(deps): update dependency eslint to v8.50.0 --- glances/outputs/static/package-lock.json | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/glances/outputs/static/package-lock.json b/glances/outputs/static/package-lock.json index 209c565a..5935434f 100644 --- a/glances/outputs/static/package-lock.json +++ b/glances/outputs/static/package-lock.json @@ -109,18 +109,18 @@ } }, "node_modules/@eslint/js": { - "version": "8.47.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.47.0.tgz", - "integrity": "sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz", + "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -1876,16 +1876,16 @@ } }, "node_modules/eslint": { - "version": "8.47.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz", - "integrity": "sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz", + "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "^8.47.0", - "@humanwhocodes/config-array": "^0.11.10", + "@eslint/js": "8.50.0", + "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.12.4", @@ -5797,15 +5797,15 @@ } }, "@eslint/js": { - "version": "8.47.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.47.0.tgz", - "integrity": "sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz", + "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==", "dev": true }, "@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", @@ -7209,16 +7209,16 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" }, "eslint": { - "version": "8.47.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz", - "integrity": "sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz", + "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "^8.47.0", - "@humanwhocodes/config-array": "^0.11.10", + "@eslint/js": "8.50.0", + "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.12.4", From 1c3df3dd41e98f55a802f76f1456615e538b68b5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 23 Sep 2023 07:21:03 +0000 Subject: [PATCH 021/126] chore(deps): update dependency sass to v1.68.0 --- glances/outputs/static/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/glances/outputs/static/package-lock.json b/glances/outputs/static/package-lock.json index 209c565a..74532042 100644 --- a/glances/outputs/static/package-lock.json +++ b/glances/outputs/static/package-lock.json @@ -4497,9 +4497,9 @@ } }, "node_modules/sass": { - "version": "1.66.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.66.1.tgz", - "integrity": "sha512-50c+zTsZOJVgFfTgwwEzkjA3/QACgdNsKueWPyAR0mRINIvLAStVQBbPg14iuqEQ74NPDbXzJARJ/O4SI1zftA==", + "version": "1.68.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.68.0.tgz", + "integrity": "sha512-Lmj9lM/fef0nQswm1J2HJcEsBUba4wgNx2fea6yJHODREoMFnwRpZydBnX/RjyXw2REIwdkbqE4hrTo4qfDBUA==", "dev": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0", @@ -9124,9 +9124,9 @@ } }, "sass": { - "version": "1.66.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.66.1.tgz", - "integrity": "sha512-50c+zTsZOJVgFfTgwwEzkjA3/QACgdNsKueWPyAR0mRINIvLAStVQBbPg14iuqEQ74NPDbXzJARJ/O4SI1zftA==", + "version": "1.68.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.68.0.tgz", + "integrity": "sha512-Lmj9lM/fef0nQswm1J2HJcEsBUba4wgNx2fea6yJHODREoMFnwRpZydBnX/RjyXw2REIwdkbqE4hrTo4qfDBUA==", "dev": true, "requires": { "chokidar": ">=3.0.0 <4.0.0", From eafc4628da73e5b6d95c6e01a0992adb5239dff4 Mon Sep 17 00:00:00 2001 From: Alexander Grigoryev Date: Tue, 26 Sep 2023 19:37:02 +0300 Subject: [PATCH 022/126] Update README.rst --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 01405fa3..b76de522 100644 --- a/README.rst +++ b/README.rst @@ -140,8 +140,8 @@ To install Glances, simply use ``pip``: pip install --user glances *Note*: Python headers are required to install `psutil`_, a Glances -dependency. For example, on Debian/Ubuntu you need to install first -the *python-dev* package (*python-devel* on Fedora/CentOS/RHEL). +dependency. For example, on Debian/Ubuntu **the simplest** is ``apt install python3-psutil`` or alternatively need to install first +the *python-dev* package and gcc (*python-devel* on Fedora/CentOS/RHEL). For Windows, just install psutil from the binary installation file. *Note 2 (for the Wifi plugin)*: If you want to use the Wifi plugin, you need From fbb0a6aafb4959bffe1089e87cf946e0977d7df8 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 27 Sep 2023 05:20:10 +0000 Subject: [PATCH 023/126] fix: dev-requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-PILLOW-5918878 --- dev-requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index aaae71eb..e0757fdc 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -11,4 +11,5 @@ memory-profiler matplotlib semgrep setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability -numpy>=1.22.2 # not directly required, pinned by Snyk to avoid a vulnerability \ No newline at end of file +numpy>=1.22.2 # not directly required, pinned by Snyk to avoid a vulnerability +pillow>=10.0.1 # not directly required, pinned by Snyk to avoid a vulnerability \ No newline at end of file From 09f6e12a871a0cb3be8b4b7a3ad640090908c31e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 01:48:44 +0000 Subject: [PATCH 024/126] chore(deps): update alpine docker tag to v3.18.4 --- docker-files/alpine.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-files/alpine.Dockerfile b/docker-files/alpine.Dockerfile index b2ce10d7..133be453 100644 --- a/docker-files/alpine.Dockerfile +++ b/docker-files/alpine.Dockerfile @@ -8,7 +8,7 @@ # Ex: Python 3.11 for Alpine 3.18 # Note: ENV is for future running containers. ARG for building your Docker image. -ARG IMAGE_VERSION=3.18.3 +ARG IMAGE_VERSION=3.18.4 ARG PYTHON_VERSION=3.11 ############################################################################## From 17fb3c8d60d11dd8b231c2b698f443c8ec93d34e Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 08:42:22 +0200 Subject: [PATCH 025/126] Add Python 3.12 support in UnitTest --- .github/workflows/test.yml | 2 +- glances/outputs/static/package-lock.json | 13 +++++++------ glances/outputs/static/public/glances.js | Bin 448470 -> 449039 bytes setup.py | 1 + tox.ini | 18 +++++++++++++----- unitest.py | 11 +++++++---- 6 files changed, 29 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d1465e3..b6b81534 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: diff --git a/glances/outputs/static/package-lock.json b/glances/outputs/static/package-lock.json index 1574316c..00e73156 100644 --- a/glances/outputs/static/package-lock.json +++ b/glances/outputs/static/package-lock.json @@ -4,6 +4,7 @@ "requires": true, "packages": { "": { + "name": "static", "dependencies": { "bootstrap": "^3.4.1", "favico.js": "^0.3.10", @@ -3953,9 +3954,9 @@ } }, "node_modules/postcss": { - "version": "8.4.23", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz", - "integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "funding": [ { "type": "opencollective", @@ -8755,9 +8756,9 @@ } }, "postcss": { - "version": "8.4.23", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz", - "integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "requires": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", diff --git a/glances/outputs/static/public/glances.js b/glances/outputs/static/public/glances.js index eebe9c505715845134791506d239ff8e210494db..5ba2cac7e88d69ac71645f5b46d642282e1efdcd 100644 GIT binary patch delta 5567 zcmaJl3v?6LmFHb+#$aRfu`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j{K6#RTq~eTfi?Ey|;Tz`(>vKq=jDT>OrhfIOj zu}1iX)#^~ms*i6F9yiUH_n7csCgCRG91RyY2_-^=+6wAZza#9XPZs>er-jn|3`fY_ zy}ek{968jbx}_=LEl zbX}nSoi|+<8q#wdUUxTj0HKg(}2AHoYZTk=Y{nN|xv#=6}c%|0NVe2upRh$G0fvvBM3Qq^}Bw&AkaCG3B&x8_8|CX4GTDO=Ak=RNx-`XvH ze4pUxkZ6Go6>XUQnUIE;hKQN`&Gq6OJ00lRBf22cjsrdyvhmVwA%id8BhCV=qrJ_A tmzRtAc;+Rsfg~KbS8OpIdD*Mt#Vm4!e?KX@g-l22ZqxJcpAjSJ{{u9?)-(VB diff --git a/setup.py b/setup.py index 917e6cdc..24e09e87 100755 --- a/setup.py +++ b/setup.py @@ -134,6 +134,7 @@ setup( 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: System :: Monitoring' ] ) diff --git a/tox.ini b/tox.ini index 6ae4a0e9..6c9d454c 100644 --- a/tox.ini +++ b/tox.ini @@ -5,16 +5,24 @@ # tox [tox] -envlist = py39 +envlist = + py38 + py39 + py310 + py311 + py312 [testenv] deps = flake8 - requests psutil + defusedxml + packaging + ujson bottle + requests commands = python unitest.py - python unitest-restful.py - python unitest-xmlrpc.py - #flake8 --exclude=build,.tox,.git + ; python unitest-restful.py + ; python unitest-xmlrpc.py + ;flake8 --exclude=build,.tox,.git diff --git a/unitest.py b/unitest.py index d80042b7..a47af590 100755 --- a/unitest.py +++ b/unitest.py @@ -397,15 +397,18 @@ class TestGlances(unittest.TestCase): def test_100_secure(self): """Test secure functions""" print('INFO: [TEST_100] Secure functions') + if WINDOWS: - self.assertEqual(secure_popen('echo TEST'), 'TEST\r\n') - self.assertEqual(secure_popen('echo TEST1 && echo TEST2'), 'TEST1\r\nTEST2\r\n') + self.assertIn(secure_popen('echo TEST'), ['TEST\n', + 'TEST\r\n']) + self.assertIn(secure_popen('echo TEST1 && echo TEST2'), ['TEST1\nTEST2\n', + 'TEST1\r\nTEST2\r\n']) else: self.assertEqual(secure_popen('echo -n TEST'), 'TEST') + self.assertEqual(secure_popen('echo -n TEST1 && echo -n TEST2'), 'TEST1TEST2') # Make the test failed on Github (AssertionError: '' != 'FOO\n') # but not on my localLinux computer... - #self.assertEqual(secure_popen('echo FOO | grep FOO'), 'FOO\n') - self.assertEqual(secure_popen('echo -n TEST1 && echo -n TEST2'), 'TEST1TEST2') + # self.assertEqual(secure_popen('echo FOO | grep FOO'), 'FOO\n') def test_200_memory_leak(self): """Memory leak check""" From 62fd5aaee8b7d1d6014bc536affa3a54e015dfdf Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 08:48:48 +0200 Subject: [PATCH 026/126] Add Python 3.12 support in UnitTest for Windows OS --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b6b81534..44d2b629 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -64,7 +64,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: From 2b641f4b5e319e10a52ff9de894a161113fa2c15 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 09:00:36 +0200 Subject: [PATCH 027/126] Remove Python 3.12 because test not working on Windows --- .github/workflows/test.yml | 5 +++-- conf/glances.conf | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44d2b629..e7fa9c44 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -64,8 +64,9 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - + # Python version "3.12" introduce this issue: + # https://github.com/nicolargo/glances/actions/runs/6439648370/job/17487567454 + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v4 diff --git a/conf/glances.conf b/conf/glances.conf index 0fdf4651..19fbbee6 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -466,7 +466,7 @@ path=/tmp # It is possible to generate the graphs automatically by setting the # generate_every to a non zero value corresponding to the seconds between # two generation. Set it to 0 to disable graph auto generation. -generate_every=60 +generate_every=0 # See following configuration keys definitions in the Pygal lib documentation # http://pygal.org/en/stable/documentation/index.html width=800 From c88e310920b036249f126f87af274a918f8cf39f Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 09:05:11 +0200 Subject: [PATCH 028/126] Add graph export for GPU plugin (related to #2542) --- glances/plugins/gpu/model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/glances/plugins/gpu/model.py b/glances/plugins/gpu/model.py index b12378cb..a4a1d924 100644 --- a/glances/plugins/gpu/model.py +++ b/glances/plugins/gpu/model.py @@ -39,7 +39,10 @@ class PluginModel(GlancesPluginModel): def __init__(self, args=None, config=None): """Init the plugin.""" - super(PluginModel, self).__init__(args=args, config=config, stats_init_value=[]) + super(PluginModel, self).__init__(args=args, + config=config, + items_history_list=items_history_list, + stats_init_value=[]) # Init the Nvidia API self.init_nvidia() From 8ee0a83d7781da919c2ded4bc28d3c1395765606 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 09:49:13 +0200 Subject: [PATCH 029/126] Make the alerts number configurable (related to #2558) --- conf/glances.conf | 29 +++++++++++++++++------------ glances/events.py | 12 ++++++++---- glances/plugins/alert/model.py | 9 ++++++++- glances/plugins/mem/model.py | 5 ++++- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/conf/glances.conf b/conf/glances.conf index 19fbbee6..ef71a4c6 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -396,35 +396,40 @@ port_default_gateway=True disable=False # Only show specific containers (comma separated list of container name or regular expression) # Comment this line to display all containers (default configuration) -#show=telegraf +; show=telegraf # Hide some containers (comma separated list of container name or regular expression) # Comment this line to display all containers (default configuration) -#hide=telegraf +; hide=telegraf # Define the maximum docker size name (default is 20 chars) max_name_size=20 -#cpu_careful=50 +; cpu_careful=50 # Thresholds for CPU and MEM (in %) -#cpu_warning=70 -#cpu_critical=90 -#mem_careful=20 -#mem_warning=50 -#mem_critical=70 +; cpu_warning=70 +; cpu_critical=90 +; mem_careful=20 +; mem_warning=50 +; mem_critical=70 # # Per container thresholds -#containername_cpu_careful=10 -#containername_cpu_warning=20 -#containername_cpu_critical=30 +; containername_cpu_careful=10 +; containername_cpu_warning=20 +; containername_cpu_critical=30 # # By default, Glances only display running containers # Set the following key to True to display all containers all=False # Define Podman sock -#podman_sock=unix:///run/user/1000/podman/podman.sock +; podman_sock=unix:///run/user/1000/podman/podman.sock [amps] # AMPs configuration are defined in the bottom of this file disable=False +[alert] +disable=True +# Maximum number of alerts to display (default is 10) +; max_events=10 + ############################################################################## # Client/server ############################################################################## diff --git a/glances/events.py b/glances/events.py index b107afa6..b1a9ba3b 100644 --- a/glances/events.py +++ b/glances/events.py @@ -35,14 +35,18 @@ class GlancesEvents(object): "top sort key"] """ - def __init__(self): + def __init__(self, max_events=10): """Init the events class.""" # Maximum size of the events list - self.events_max = 10 + self.set_max_events(max_events) # Init the logs list self.events_list = [] + def set_max_events(self, max_events): + """Set the maximum size of the events list.""" + self.max_events = max_events + def get(self): """Return the raw events list.""" return self.events_list @@ -138,8 +142,8 @@ class GlancesEvents(object): # Add the item to the list self.events_list.insert(0, item) - # Limit the list to 'events_max' items - if self.len() > self.events_max: + # Limit the list to 'max_events' items + if self.len() > self.max_events: self.events_list.pop() return True diff --git a/glances/plugins/alert/model.py b/glances/plugins/alert/model.py index 3ccdf36a..950acec5 100644 --- a/glances/plugins/alert/model.py +++ b/glances/plugins/alert/model.py @@ -11,6 +11,7 @@ from datetime import datetime +from glances.logger import logger from glances.events import glances_events from glances.thresholds import glances_thresholds @@ -170,7 +171,9 @@ class PluginModel(GlancesPluginModel): def __init__(self, args=None, config=None): """Init the plugin.""" - super(PluginModel, self).__init__(args=args, config=config, stats_init_value=[]) + super(PluginModel, self).__init__(args=args, + config=config, + stats_init_value=[]) # We want to display the stat in the curse interface self.display_curse = True @@ -178,6 +181,10 @@ class PluginModel(GlancesPluginModel): # Set the message position self.align = 'bottom' + # Set the maximum number of events to display + if config is not None and (config.has_section('alert') or config.has_section('alerts')): + glances_events.set_max_events(config.get_int_value('alert', 'max_events')) + def update(self): """Nothing to do here. Just return the global glances_log.""" # Set the stats to the glances_events diff --git a/glances/plugins/mem/model.py b/glances/plugins/mem/model.py index 52ceed0c..fb000b2d 100644 --- a/glances/plugins/mem/model.py +++ b/glances/plugins/mem/model.py @@ -115,7 +115,10 @@ class PluginModel(GlancesPluginModel): def __init__(self, args=None, config=None): """Init the plugin.""" super(PluginModel, self).__init__( - args=args, config=config, items_history_list=items_history_list, fields_description=fields_description + args=args, + config=config, + items_history_list=items_history_list, + fields_description=fields_description ) # We want to display the stat in the curse interface From cca55759ee02a32a2e2506ec7fed3b59a899d749 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 09:58:12 +0200 Subject: [PATCH 030/126] Update glances.conf file for Docker --- conf/glances.conf | 2 +- docker-compose/glances.conf | 33 +++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/conf/glances.conf b/conf/glances.conf index ef71a4c6..7bf00d66 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -426,7 +426,7 @@ all=False disable=False [alert] -disable=True +disable=False # Maximum number of alerts to display (default is 10) ; max_events=10 diff --git a/docker-compose/glances.conf b/docker-compose/glances.conf index ad22d4ae..ed44d51b 100644 --- a/docker-compose/glances.conf +++ b/docker-compose/glances.conf @@ -22,7 +22,7 @@ history_size=1200 [outputs] # Theme name for the Curses interface: black or white curse_theme=black -# Limit the number of processes to display in the WebUI +# Limit the number of processes to display (for the WebUI) max_processes_display=30 # Set the URL prefix (for the WebUI and the API) # Example: url_prefix=/glances/ => http://localhost/glances/ @@ -400,35 +400,40 @@ port_default_gateway=True disable=False # Only show specific containers (comma separated list of container name or regular expression) # Comment this line to display all containers (default configuration) -#show=telegraf +; show=telegraf # Hide some containers (comma separated list of container name or regular expression) # Comment this line to display all containers (default configuration) -#hide=telegraf +; hide=telegraf # Define the maximum docker size name (default is 20 chars) max_name_size=20 -#cpu_careful=50 +; cpu_careful=50 # Thresholds for CPU and MEM (in %) -#cpu_warning=70 -#cpu_critical=90 -#mem_careful=20 -#mem_warning=50 -#mem_critical=70 +; cpu_warning=70 +; cpu_critical=90 +; mem_careful=20 +; mem_warning=50 +; mem_critical=70 # # Per container thresholds -#containername_cpu_careful=10 -#containername_cpu_warning=20 -#containername_cpu_critical=30 +; containername_cpu_careful=10 +; containername_cpu_warning=20 +; containername_cpu_critical=30 # # By default, Glances only display running containers # Set the following key to True to display all containers all=False # Define Podman sock -#podman_sock=unix:///run/user/1000/podman/podman.sock +; podman_sock=unix:///run/user/1000/podman/podman.sock [amps] # AMPs configuration are defined in the bottom of this file disable=False +[alert] +disable=False +# Maximum number of alerts to display (default is 10) +; max_events=10 + ############################################################################## # Client/server ############################################################################## @@ -470,7 +475,7 @@ path=/tmp # It is possible to generate the graphs automatically by setting the # generate_every to a non zero value corresponding to the seconds between # two generation. Set it to 0 to disable graph auto generation. -generate_every=60 +generate_every=0 # See following configuration keys definitions in the Pygal lib documentation # http://pygal.org/en/stable/documentation/index.html width=800 From 792e33292174dab173a452332946e781e1ed4f8a Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 10:15:41 +0200 Subject: [PATCH 031/126] Docker Prometheus issue with IRQ plugin #2564 --- conf/glances.conf | 2 +- glances/exports/prometheus/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/glances.conf b/conf/glances.conf index 7bf00d66..90867b36 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -240,7 +240,7 @@ critical=90 [irq] # Documentation: https://glances.readthedocs.io/en/latest/aoa/irq.html # This plugin is disabled by default -disable=True +disable=False [folders] # Documentation: https://glances.readthedocs.io/en/latest/aoa/folders.html diff --git a/glances/exports/prometheus/__init__.py b/glances/exports/prometheus/__init__.py index 9e90e129..919aeabb 100644 --- a/glances/exports/prometheus/__init__.py +++ b/glances/exports/prometheus/__init__.py @@ -71,7 +71,7 @@ class Export(GlancesExport): metric_name = self.prefix + self.METRIC_SEPARATOR + str(name) + self.METRIC_SEPARATOR + str(k) # Prometheus is very sensible to the metric name # See: https://prometheus.io/docs/practices/naming/ - for c in ['.', '-', '/', ' ']: + for c in ' .-/:[]': metric_name = metric_name.replace(c, self.METRIC_SEPARATOR) # Get the labels labels = self.parse_tags(self.labels) From 0f938bead49f0e5aca0850857df837d1e89f8daa Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 10:18:39 +0200 Subject: [PATCH 032/126] Disable IRQ per default --- conf/glances.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/glances.conf b/conf/glances.conf index 90867b36..7bf00d66 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -240,7 +240,7 @@ critical=90 [irq] # Documentation: https://glances.readthedocs.io/en/latest/aoa/irq.html # This plugin is disabled by default -disable=False +disable=True [folders] # Documentation: https://glances.readthedocs.io/en/latest/aoa/folders.html From ccb74c85700a724959b88be6fb7c82345b36eb95 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 10:24:05 +0200 Subject: [PATCH 033/126] MongoDB and CouchDB documentation flipped #2565 --- docs/api.rst | 338 +++++++++++++++++++++++--------------------- docs/gw/couchdb.rst | 41 +++--- docs/gw/mongodb.rst | 41 +++--- docs/man/glances.1 | 2 +- 4 files changed, 216 insertions(+), 206 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 56921a56..f88b4715 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -78,25 +78,6 @@ Get the plugins list:: "uptime", "wifi"] -GET alert ---------- - -Get plugin stats:: - - # curl http://localhost:61208/api/3/alert - [[1692001850.0, - -1, - "WARNING", - "MEM", - 86.74449323293155, - 86.74449323293155, - 86.74449323293155, - 86.74449323293155, - 1, - [], - "", - "memory_percent"]] - GET amps -------- @@ -111,7 +92,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.3125603199005127}, + "timer": 0.1688997745513916}, {"count": 0, "countmax": 20.0, "countmin": None, @@ -120,7 +101,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.31241464614868164}] + "timer": 0.1687941551208496}] Get a specific field:: @@ -138,7 +119,7 @@ Get a specific item when field matches the given value:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.3125603199005127}]} + "timer": 0.1688997745513916}]} GET connections --------------- @@ -159,12 +140,37 @@ GET containers Get plugin stats:: # curl http://localhost:61208/api/3/containers - {"containers": [{"Command": ["/portainer"], + {"containers": [{"Command": ["/usr/local/bin/entrypoint", "/sbin/init"], + "Created": "2023-09-23T08:45:37.9847178Z", + "Id": "3b375dd5868fa54c30dd67ca296cf27885404194b478f82c20fbfae609c20d85", + "Image": ["gcr.io/k8s-minikube/kicbase:v0.0.40"], + "Status": "running", + "Uptime": "1 weeks", + "cpu": {"total": 0.0}, + "cpu_percent": 0.0, + "engine": "docker", + "io": {"cumulative_ior": 97918976, + "cumulative_iow": 188833792}, + "io_r": None, + "io_w": None, + "key": "name", + "memory": {"cache": None, + "limit": 2306867200, + "max_usage": None, + "rss": None, + "usage": 717176832}, + "memory_usage": 717176832, + "name": "minikube", + "network": {"cumulative_rx": 6072033, + "cumulative_tx": 89450523}, + "network_rx": None, + "network_tx": None}, + {"Command": ["/portainer"], "Created": "2022-10-29T14:59:10.266701439Z", "Id": "3abd51c615968482d9ccff5afc629f267f6dda113ed68b75b432615fae3b49fb", "Image": ["portainer/portainer-ce:2.9.3"], "Status": "running", - "Uptime": "1 weeks", + "Uptime": "2 weeks", "cpu": {"total": 0.0}, "cpu_percent": 0.0, "engine": "docker", @@ -209,19 +215,19 @@ Get plugin stats:: "ctx_switches": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 58.6, + "idle": 66.9, "interrupts": 0, - "iowait": 0.9, + "iowait": 0.8, "irq": 0.0, - "nice": 0.5, + "nice": 0.0, "soft_interrupts": 0, - "softirq": 0.0, + "softirq": 0.8, "steal": 0.0, "syscalls": 0, - "system": 10.9, + "system": 7.6, "time_since_update": 1, - "total": 40.5, - "user": 29.1} + "total": 32.2, + "user": 23.7} Fields descriptions: @@ -244,7 +250,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/cpu/total - {"total": 40.5} + {"total": 32.2} GET diskio ---------- @@ -290,13 +296,13 @@ Get plugin stats:: # curl http://localhost:61208/api/3/fs [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 22384226304, + "free": 18324307968, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 90.3, + "percent": 92.1, "size": 243334156288, - "used": 208562475008}, + "used": 212622393344}, {"device_name": "zsfpool", "free": 41811968, "fs_type": "zfs", @@ -315,13 +321,13 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/3/fs/mnt_point// {"/": [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", - "free": 22384226304, + "free": 18324307968, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", - "percent": 90.3, + "percent": 92.1, "size": 243334156288, - "used": 208562475008}]} + "used": 212622393344}]} GET ip ------ @@ -329,17 +335,17 @@ GET ip Get plugin stats:: # curl http://localhost:61208/api/3/ip - {"address": "192.168.1.14", - "gateway": "192.168.1.1", + {"address": "192.168.0.32", + "gateway": "192.168.0.254", "mask": "255.255.255.0", "mask_cidr": 24, - "public_address": "92.151.148.66", + "public_address": "91.166.228.228", "public_info_human": ""} Get a specific field:: # curl http://localhost:61208/api/3/ip/gateway - {"gateway": "192.168.1.1"} + {"gateway": "192.168.0.254"} GET load -------- @@ -347,7 +353,10 @@ GET load Get plugin stats:: # curl http://localhost:61208/api/3/load - {"cpucore": 4, "min1": 1.71875, "min15": 1.73095703125, "min5": 1.798828125} + {"cpucore": 4, + "min1": 1.2158203125, + "min15": 1.14794921875, + "min5": 1.13916015625} Fields descriptions: @@ -359,7 +368,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/load/min1 - {"min1": 1.71875} + {"min1": 1.2158203125} GET mem ------- @@ -367,16 +376,16 @@ GET mem Get plugin stats:: # curl http://localhost:61208/api/3/mem - {"active": 1974509568, - "available": 1037058048, - "buffers": 55336960, - "cached": 1280933888, - "free": 1037058048, - "inactive": 2258354176, - "percent": 86.7, - "shared": 444837888, + {"active": 2829647872, + "available": 1697103872, + "buffers": 98603008, + "cached": 2016976896, + "free": 1697103872, + "inactive": 3575861248, + "percent": 78.3, + "shared": 469102592, "total": 7823601664, - "used": 6786543616} + "used": 6126497792} Fields descriptions: @@ -403,13 +412,13 @@ GET memswap Get plugin stats:: # curl http://localhost:61208/api/3/memswap - {"free": 5001969664, - "percent": 38.1, - "sin": 2162475008, - "sout": 4830765056, + {"free": 3605164032, + "percent": 55.4, + "sin": 19573440512, + "sout": 27570544640, "time_since_update": 1, "total": 8082419712, - "used": 3080450048} + "used": 4477255680} Fields descriptions: @@ -433,9 +442,9 @@ Get plugin stats:: # curl http://localhost:61208/api/3/network [{"alias": None, - "cumulative_cx": 1113168746, - "cumulative_rx": 556584373, - "cumulative_tx": 556584373, + "cumulative_cx": 1329145058, + "cumulative_rx": 664572529, + "cumulative_tx": 664572529, "cx": 0, "interface_name": "lo", "is_up": True, @@ -445,17 +454,17 @@ Get plugin stats:: "time_since_update": 1, "tx": 0}, {"alias": None, - "cumulative_cx": 8311348554, - "cumulative_rx": 8123752443, - "cumulative_tx": 187596111, - "cx": 224, + "cumulative_cx": 17462918931, + "cumulative_rx": 16928655854, + "cumulative_tx": 534263077, + "cx": 424, "interface_name": "wlp2s0", "is_up": True, "key": "interface_name", - "rx": 98, + "rx": 184, "speed": 0, "time_since_update": 1, - "tx": 126}] + "tx": 240}] Fields descriptions: @@ -478,17 +487,24 @@ Get a specific field:: "wlp2s0", "br_grafana", "docker0", + "veth6cdd773", "veth0ada394", "mpqemubr0", - "vboxnet0"]} + "vboxnet0", + "br-66c7462713f6", + "veth268b5e5", + "veth93720a7", + "vethf4737f4", + "br-40875d2e2716", + "veth1df26b1"]} Get a specific item when field matches the given value:: # curl http://localhost:61208/api/3/network/interface_name/lo {"lo": [{"alias": None, - "cumulative_cx": 1113168746, - "cumulative_rx": 556584373, - "cumulative_tx": 556584373, + "cumulative_cx": 1329145058, + "cumulative_rx": 664572529, + "cumulative_tx": 664572529, "cx": 0, "interface_name": "lo", "is_up": True, @@ -504,7 +520,7 @@ GET now Get plugin stats:: # curl http://localhost:61208/api/3/now - "2023-08-14 10:30:50 CEST" + "2023-10-07 10:23:53 CEST" GET percpu ---------- @@ -515,29 +531,29 @@ Get plugin stats:: [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 32.0, + "idle": 11.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 8.0, - "total": 68.0, - "user": 14.0}, + "system": 4.0, + "total": 89.0, + "user": 15.0}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 37.0, - "iowait": 0.0, + "idle": 19.0, + "iowait": 1.0, "irq": 0.0, "key": "cpu_number", - "nice": 1.0, + "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 6.0, - "total": 63.0, - "user": 11.0}] + "system": 1.0, + "total": 81.0, + "user": 8.0}] Get a specific field:: @@ -551,30 +567,30 @@ Get plugin stats:: # curl http://localhost:61208/api/3/ports [{"description": "DefaultGateway", - "host": "192.168.1.1", + "host": "192.168.0.254", "indice": "port_0", "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.006752, + "status": 0.003303, "timeout": 3}] Get a specific field:: # curl http://localhost:61208/api/3/ports/host - {"host": ["192.168.1.1"]} + {"host": ["192.168.0.254"]} Get a specific item when field matches the given value:: - # curl http://localhost:61208/api/3/ports/host/192.168.1.1 - {"192.168.1.1": [{"description": "DefaultGateway", - "host": "192.168.1.1", - "indice": "port_0", - "port": 0, - "refresh": 30, - "rtt_warning": None, - "status": 0.006752, - "timeout": 3}]} + # curl http://localhost:61208/api/3/ports/host/192.168.0.254 + {"192.168.0.254": [{"description": "DefaultGateway", + "host": "192.168.0.254", + "indice": "port_0", + "port": 0, + "refresh": 30, + "rtt_warning": None, + "status": 0.003303, + "timeout": 3}]} GET processcount ---------------- @@ -582,12 +598,12 @@ GET processcount Get plugin stats:: # curl http://localhost:61208/api/3/processcount - {"pid_max": 0, "running": 1, "sleeping": 309, "thread": 1606, "total": 377} + {"pid_max": 0, "running": 1, "sleeping": 358, "thread": 2123, "total": 424} Get a specific field:: # curl http://localhost:61208/api/3/processcount/total - {"total": 377} + {"total": 424} GET psutilversion ----------------- @@ -603,69 +619,69 @@ GET quicklook Get plugin stats:: # curl http://localhost:61208/api/3/quicklook - {"cpu": 40.5, - "cpu_hz": 2025000000.0, - "cpu_hz_current": 2048946250.0, + {"cpu": 32.2, + "cpu_hz": 3000000000.0, + "cpu_hz_current": 2628401500.0, "cpu_name": "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz", - "mem": 86.7, + "mem": 78.3, "percpu": [{"cpu_number": 0, "guest": 0.0, "guest_nice": 0.0, - "idle": 32.0, + "idle": 11.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 8.0, - "total": 68.0, - "user": 14.0}, + "system": 4.0, + "total": 89.0, + "user": 15.0}, {"cpu_number": 1, "guest": 0.0, "guest_nice": 0.0, - "idle": 37.0, - "iowait": 0.0, + "idle": 19.0, + "iowait": 1.0, "irq": 0.0, "key": "cpu_number", - "nice": 1.0, + "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 6.0, - "total": 63.0, - "user": 11.0}, + "system": 1.0, + "total": 81.0, + "user": 8.0}, {"cpu_number": 2, "guest": 0.0, "guest_nice": 0.0, - "idle": 29.0, + "idle": 24.0, + "iowait": 1.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 1.0, + "total": 76.0, + "user": 4.0}, + {"cpu_number": 3, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 27.0, "iowait": 0.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 8.0, - "total": 71.0, - "user": 17.0}, - {"cpu_number": 3, - "guest": 0.0, - "guest_nice": 0.0, - "idle": 30.0, - "iowait": 1.0, - "irq": 0.0, - "key": "cpu_number", - "nice": 1.0, - "softirq": 0.0, - "steal": 0.0, "system": 2.0, - "total": 70.0, - "user": 22.0}], - "swap": 38.1} + "total": 73.0, + "user": 2.0}], + "swap": 55.4} Get a specific field:: # curl http://localhost:61208/api/3/quicklook/cpu - {"cpu": 40.5} + {"cpu": 32.2} GET sensors ----------- @@ -736,7 +752,7 @@ GET uptime Get plugin stats:: # curl http://localhost:61208/api/3/uptime - "7 days, 23:04:48" + "61 days, 22:57:43" GET all stats ------------- @@ -752,24 +768,18 @@ GET top n items of a specific plugin Get top 2 processes of the processlist plugin:: # curl http://localhost:61208/api/3/processlist/top/2 - [{"cmdline": ["/usr/lib/virtualbox/VBoxHeadless", - "--comment", - "minikube", - "--startvm", - "3aa18a3e-08d7-418b-9d17-ecf2f6079bbd", - "--vrde", - "config"], + [{"cmdline": ["/snap/firefox/2908/usr/lib/firefox/firefox"], "cpu_percent": 0.0, - "cpu_times": pcputimes(user=183.52, system=2738.49, children_user=0.0, children_system=0.0, iowait=0.0), + "cpu_times": pcputimes(user=11580.71, system=3577.12, children_user=9078.74, children_system=1390.45, iowait=0.0), "gids": pgids(real=1000, effective=1000, saved=1000), - "io_counters": [0, 0, 0, 0, 0], + "io_counters": [13420777472, 17349627904, 0, 0, 0], "key": "pid", - "memory_info": pmem(rss=2335199232, vms=4198170624, shared=2333605888, text=40960, lib=0, data=87470080, dirty=0), - "memory_percent": 29.848135581152206, - "name": "VBoxHeadless", + "memory_info": pmem(rss=533090304, vms=22503579648, shared=103047168, text=643072, lib=0, data=1594458112, dirty=0), + "memory_percent": 6.813873288730872, + "name": "firefox", "nice": 0, - "num_threads": 28, - "pid": 81109, + "num_threads": 180, + "pid": 6490, "status": "S", "time_since_update": 1, "username": "nicolargo"}, @@ -793,12 +803,12 @@ Get top 2 processes of the processlist plugin:: "true", "tab"], "cpu_percent": 0.0, - "cpu_times": pcputimes(user=637.59, system=77.54, children_user=0.0, children_system=0.0, iowait=0.0), + "cpu_times": pcputimes(user=1792.99, system=226.55, children_user=0.0, children_system=0.0, iowait=0.0), "gids": pgids(real=1000, effective=1000, saved=1000), - "io_counters": [581462016, 0, 0, 0, 0], + "io_counters": [2603199488, 0, 0, 0, 0], "key": "pid", - "memory_info": pmem(rss=427667456, vms=3597381632, shared=27496448, text=643072, lib=0, data=1006702592, dirty=0), - "memory_percent": 5.466375645987899, + "memory_info": pmem(rss=501956608, vms=4198289408, shared=37511168, text=643072, lib=0, data=1584558080, dirty=0), + "memory_percent": 6.415927466114921, "name": "WebExtensions", "nice": 0, "num_threads": 20, @@ -815,34 +825,34 @@ GET stats history History of a plugin:: # curl http://localhost:61208/api/3/cpu/history - {"system": [["2023-08-14T10:30:51.996947", 10.9], - ["2023-08-14T10:30:53.034098", 12.8], - ["2023-08-14T10:30:54.245612", 12.8]], - "user": [["2023-08-14T10:30:51.996926", 29.1], - ["2023-08-14T10:30:53.034088", 13.3], - ["2023-08-14T10:30:54.245590", 13.3]]} + {"system": [["2023-10-07T10:23:55.322302", 7.6], + ["2023-10-07T10:23:56.352046", 2.5], + ["2023-10-07T10:23:57.502402", 2.5]], + "user": [["2023-10-07T10:23:55.322289", 23.7], + ["2023-10-07T10:23:56.352036", 9.9], + ["2023-10-07T10:23:57.502391", 9.9]]} Limit history to last 2 values:: # curl http://localhost:61208/api/3/cpu/history/2 - {"system": [["2023-08-14T10:30:53.034098", 12.8], - ["2023-08-14T10:30:54.245612", 12.8]], - "user": [["2023-08-14T10:30:53.034088", 13.3], - ["2023-08-14T10:30:54.245590", 13.3]]} + {"system": [["2023-10-07T10:23:56.352046", 2.5], + ["2023-10-07T10:23:57.502402", 2.5]], + "user": [["2023-10-07T10:23:56.352036", 9.9], + ["2023-10-07T10:23:57.502391", 9.9]]} History for a specific field:: # curl http://localhost:61208/api/3/cpu/system/history - {"system": [["2023-08-14T10:30:50.142286", 10.9], - ["2023-08-14T10:30:51.996947", 10.9], - ["2023-08-14T10:30:53.034098", 12.8], - ["2023-08-14T10:30:54.245612", 12.8]]} + {"system": [["2023-10-07T10:23:53.734251", 7.6], + ["2023-10-07T10:23:55.322302", 7.6], + ["2023-10-07T10:23:56.352046", 2.5], + ["2023-10-07T10:23:57.502402", 2.5]]} Limit history for a specific field to last 2 values:: # curl http://localhost:61208/api/3/cpu/system/history - {"system": [["2023-08-14T10:30:53.034098", 12.8], - ["2023-08-14T10:30:54.245612", 12.8]]} + {"system": [["2023-10-07T10:23:56.352046", 2.5], + ["2023-10-07T10:23:57.502402", 2.5]]} GET limits (used for thresholds) -------------------------------- @@ -850,7 +860,7 @@ GET limits (used for thresholds) All limits/thresholds:: # curl http://localhost:61208/api/3/all/limits - {"alert": {"history_size": 1200.0}, + {"alert": {"alert_disable": ["False"], "history_size": 1200.0}, "amps": {"amps_disable": ["False"], "history_size": 1200.0}, "containers": {"containers_all": ["False"], "containers_disable": ["False"], diff --git a/docs/gw/couchdb.rst b/docs/gw/couchdb.rst index 3e4d92bd..b5bf2e0f 100644 --- a/docs/gw/couchdb.rst +++ b/docs/gw/couchdb.rst @@ -9,35 +9,42 @@ following: .. code-block:: ini - [mongodb] + [couchdb] host=localhost - port=27017 - db=glances + port= user=root password=example + db=glances and run Glances with: .. code-block:: console - $ glances --export mongodb + $ glances --export couchdb -Documents are stored in native the configured database (glances by default) -with one collection per plugin. +Documents are stored in native ``JSON`` format. Glances adds ``"type"`` +and ``"time"`` entries: -Example of MongoDB Document for the load stats: +- ``type``: plugin name +- ``time``: timestamp (format: "2016-09-24T16:39:08.524828Z") + +Example of Couch Document for the load stats: .. code-block:: json { - _id: ObjectId('63d78ffee5528e543ce5af3a'), - min1: 1.46337890625, - min5: 1.09619140625, - min15: 1.07275390625, - cpucore: 4, - history_size: 1200, - load_disable: 'False', - load_careful: 0.7, - load_warning: 1, - load_critical: 5 + "_id": "36cbbad81453c53ef08804cb2612d5b6", + "_rev": "1-382400899bec5615cabb99aa34df49fb", + "min15": 0.33, + "time": "2016-09-24T16:39:08.524828Z", + "min5": 0.4, + "cpucore": 4, + "load_warning": 1, + "min1": 0.5, + "history_size": 28800, + "load_critical": 5, + "type": "load", + "load_careful": 0.7 } + +You can view the result using the CouchDB utils URL: http://127.0.0.1:5984/_utils/database.html?glances. diff --git a/docs/gw/mongodb.rst b/docs/gw/mongodb.rst index 4ef71692..431c2dd9 100644 --- a/docs/gw/mongodb.rst +++ b/docs/gw/mongodb.rst @@ -9,42 +9,35 @@ following: .. code-block:: ini - [couchdb] + [mongodb] host=localhost - port= + port=27017 + db=glances user=root password=example - db=glances and run Glances with: .. code-block:: console - $ glances --export couchdb + $ glances --export mongodb -Documents are stored in native ``JSON`` format. Glances adds ``"type"`` -and ``"time"`` entries: +Documents are stored in native the configured database (glances by default) +with one collection per plugin. -- ``type``: plugin name -- ``time``: timestamp (format: "2016-09-24T16:39:08.524828Z") - -Example of Couch Document for the load stats: +Example of MongoDB Document for the load stats: .. code-block:: json { - "_id": "36cbbad81453c53ef08804cb2612d5b6", - "_rev": "1-382400899bec5615cabb99aa34df49fb", - "min15": 0.33, - "time": "2016-09-24T16:39:08.524828Z", - "min5": 0.4, - "cpucore": 4, - "load_warning": 1, - "min1": 0.5, - "history_size": 28800, - "load_critical": 5, - "type": "load", - "load_careful": 0.7 + _id: ObjectId('63d78ffee5528e543ce5af3a'), + min1: 1.46337890625, + min5: 1.09619140625, + min15: 1.07275390625, + cpucore: 4, + history_size: 1200, + load_disable: 'False', + load_careful: 0.7, + load_warning: 1, + load_critical: 5 } - -You can view the result using the CouchDB utils URL: http://127.0.0.1:5984/_utils/database.html?glances. diff --git a/docs/man/glances.1 b/docs/man/glances.1 index 62d39203..d6451f25 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" "Aug 14, 2023" "4.0.0_beta01" "Glances" +.TH "GLANCES" "1" "Oct 07, 2023" "4.0.0_beta01" "Glances" .SH NAME glances \- An eye on your system .SH SYNOPSIS From cb4a8b80b7e4b440132df8aed8fac4203d1dc6d9 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 7 Oct 2023 10:46:23 +0200 Subject: [PATCH 034/126] Apply #2563 on develop branch --- docs/docker.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docker.rst b/docs/docker.rst index 9983dc45..ad91fd3d 100644 --- a/docs/docker.rst +++ b/docs/docker.rst @@ -119,7 +119,7 @@ You can also include Glances container in you own `docker-compose.yml`. Here's a - "traefik.frontend.rule=Host:whoami.docker.localhost" monitoring: - image: nicolargo/glances:latest-alpine + image: nicolargo/glances:latest restart: always pid: host volumes: From 55d7c07543a52c82839ea177763d4840f228bab7 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 8 Oct 2023 10:10:13 +0200 Subject: [PATCH 035/126] CouchDB migration from CouchDB to PyCouchDB library #2570 --- README.rst | 2 +- conf/glances.conf | 6 ++-- docs/gw/couchdb.rst | 8 ++--- glances/exports/couchdb/__init__.py | 56 ++++++++++++++--------------- optional-requirements.txt | 2 +- setup.py | 4 +-- 6 files changed, 36 insertions(+), 42 deletions(-) diff --git a/README.rst b/README.rst index b76de522..3af03fe4 100644 --- a/README.rst +++ b/README.rst @@ -95,7 +95,6 @@ Optional dependencies: - ``bottle`` (for Web server mode) - ``cassandra-driver`` (for the Cassandra export module) - ``chevron`` (for the action script feature) -- ``couchdb`` (for the CouchDB export module) - ``docker`` (for the Containers Docker monitoring support) - ``elasticsearch`` (for the Elastic Search export module) - ``graphitesender`` (For the Graphite export module) @@ -105,6 +104,7 @@ Optional dependencies: - ``kafka-python`` (for the Kafka export module) - ``netifaces`` (for the IP plugin) - ``py3nvml`` (for the GPU plugin) +- ``pycouchdb`` (for the CouchDB export module) - ``pika`` (for the RabbitMQ/ActiveMQ export module) - ``podman`` (for the Containers Podman monitoring support) - ``potsdb`` (for the OpenTSDB export module) diff --git a/conf/glances.conf b/conf/glances.conf index 7bf00d66..d957ed3f 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -595,10 +595,8 @@ topic_structure=per-metric host=localhost port=5984 db=glances -# user and password are optional (comment if not configured on the server side) -# If they are used, then the https protocol will be used -#user=root -#password=root +user=admin +password=admin [mongodb] # Configuration for the --export mongodb option diff --git a/docs/gw/couchdb.rst b/docs/gw/couchdb.rst index b5bf2e0f..5916ba8f 100644 --- a/docs/gw/couchdb.rst +++ b/docs/gw/couchdb.rst @@ -11,10 +11,10 @@ following: [couchdb] host=localhost - port= + port=5984 + db=glances user=root password=example - db=glances and run Glances with: @@ -26,7 +26,7 @@ Documents are stored in native ``JSON`` format. Glances adds ``"type"`` and ``"time"`` entries: - ``type``: plugin name -- ``time``: timestamp (format: "2016-09-24T16:39:08.524828Z") +- ``time``: timestamp (format: "2016-09-24T16:39:08.524Z") Example of Couch Document for the load stats: @@ -36,7 +36,7 @@ Example of Couch Document for the load stats: "_id": "36cbbad81453c53ef08804cb2612d5b6", "_rev": "1-382400899bec5615cabb99aa34df49fb", "min15": 0.33, - "time": "2016-09-24T16:39:08.524828Z", + "time": "2016-09-24T16:39:08.524Z", "min5": 0.4, "cpucore": 4, "load_warning": 1, diff --git a/glances/exports/couchdb/__init__.py b/glances/exports/couchdb/__init__.py index 4c50000c..7f3a216a 100644 --- a/glances/exports/couchdb/__init__.py +++ b/glances/exports/couchdb/__init__.py @@ -9,14 +9,21 @@ """CouchDB interface class.""" +# +# How to test ? +# +# 1) docker run -d -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=admin -p 5984:5984 --name my-couchdb couchdb +# 2) ./venv/bin/python -m glances -C ./conf/glances.conf --export couchdb --quiet +# 3) Result can be seen at: http://127.0.0.1:5984/_utils +# + import sys from datetime import datetime from glances.logger import logger from glances.exports.export import GlancesExport -import couchdb -import couchdb.mapping +import pycouchdb class Export(GlancesExport): @@ -27,15 +34,11 @@ class Export(GlancesExport): """Init the CouchDB export IF.""" super(Export, self).__init__(config=config, args=args) - # Mandatory configuration keys (additional to host and port) - self.db = None - - # Optional configuration keys - self.user = None - self.password = None - - # Load the Cassandra configuration file section - self.export_enable = self.load_conf('couchdb', mandatories=['host', 'port', 'db'], options=['user', 'password']) + # Load the CouchDB configuration file section + # User and Password are mandatory with CouchDB 3.0 and higher + self.export_enable = self.load_conf('couchdb', + mandatories=['host', 'port', 'db', + 'user', 'password']) if not self.export_enable: sys.exit(2) @@ -47,35 +50,29 @@ class Export(GlancesExport): if not self.export_enable: return None - if self.user is None: - server_uri = 'http://{}:{}/'.format(self.host, self.port) - else: - # Force https if a login/password is provided - # Related to https://github.com/nicolargo/glances/issues/2124 - server_uri = 'https://{}:{}@{}:{}/'.format(self.user, self.password, self.host, self.port) + # @TODO: https + server_uri = 'http://{}:{}@{}:{}/'.format(self.user, self.password, + self.host, self.port) try: - s = couchdb.Server(server_uri) + s = pycouchdb.Server(server_uri) except Exception as e: logger.critical("Cannot connect to CouchDB server (%s)" % e) sys.exit(2) else: - logger.info("Connected to the CouchDB server") + logger.info("Connected to the CouchDB server version %s" % s.info()['version']) try: - s[self.db] + s.database(self.db) except Exception: # Database did not exist # Create it... s.create(self.db) + logger.info("Create CouchDB database %s" % self.db) else: - logger.info("There is already a %s database" % self.db) + logger.info("CouchDB database %s already exist" % self.db) - return s - - def database(self): - """Return the CouchDB database object""" - return self.client[self.db] + return s.database(self.db) def export(self, name, columns, points): """Write the points to the CouchDB server.""" @@ -84,13 +81,12 @@ class Export(GlancesExport): # Create DB input data = dict(zip(columns, points)) - # Set the type to the current stat name + # Add the type and the timestamp in ISO format data['type'] = name - data['time'] = couchdb.mapping.DateTimeField()._to_json(datetime.now()) + data['time'] = datetime.now().isoformat()[:-3] + 'Z' # Write data to the CouchDB database - # Result can be seen at: http://127.0.0.1:5984/_utils try: - self.client[self.db].save(data) + self.client.save(data) except Exception as e: logger.error("Cannot export {} stats to CouchDB ({})".format(name, e)) diff --git a/optional-requirements.txt b/optional-requirements.txt index d53ef338..0de8809c 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -6,7 +6,6 @@ bernhard bottle cassandra-driver chevron -couchdb docker>=6.1.1 elasticsearch graphitesender @@ -21,6 +20,7 @@ pika podman; python_version >= "3.6" potsdb prometheus_client +pycouchdb pygal pymdstat pymongo; python_version >= "3.7" diff --git a/setup.py b/setup.py index 24e09e87..092a3a82 100755 --- a/setup.py +++ b/setup.py @@ -56,8 +56,8 @@ def get_install_extras_require(): 'browser': ['zeroconf>=0.19.1'], 'cloud': ['requests'], 'containers': ['docker>=6.1.1', 'python-dateutil', 'six', 'podman', 'packaging'], - 'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch', - 'graphitesender', 'influxdb>=1.0.0', 'influxdb-client', 'pymongo', + 'export': ['bernhard', 'cassandra-driver', 'elasticsearch', 'graphitesender', + 'ibmcloudant', 'influxdb>=1.0.0', 'influxdb-client', 'pymongo', 'kafka-python', 'pika', 'paho-mqtt', 'potsdb', 'prometheus_client', 'pyzmq', 'statsd'], 'gpu': ['py3nvml'], From 0dc020037507be0e58bf68d4c4bd9e2913b3f3f8 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 8 Oct 2023 18:55:54 +0200 Subject: [PATCH 036/126] Refactor glances.main.GlancesMain.parse_args() --- glances/main.py | 127 +++++++++++++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 50 deletions(-) diff --git a/glances/main.py b/glances/main.py index ead588d1..aa7c58d6 100644 --- a/glances/main.py +++ b/glances/main.py @@ -12,6 +12,8 @@ import argparse import sys import tempfile +from logging import DEBUG +from warnings import simplefilter from glances import __version__, psutil_version from glances.globals import WINDOWS, disable, enable @@ -121,12 +123,17 @@ Examples of use: parser.add_argument( '--disable-plugin', '--disable-plugins', + '--disable', dest='disable_plugin', help='disable plugin (comma separated list or all). If all is used, \ then you need to configure --enable-plugin.', ) parser.add_argument( - '--enable-plugin', '--enable-plugins', dest='enable_plugin', help='enable plugin (comma separated list)' + '--enable-plugin', + '--enable-plugins', + '--enable', + dest='enable_plugin', + help='enable plugin (comma separated list)' ) parser.add_argument( '--disable-process', @@ -533,36 +540,28 @@ Examples of use: return parser - def parse_args(self): - """Parse command line arguments.""" - args = self.init_args().parse_args() - - # Load the configuration file, if it exists - # This function should be called after the parse_args - # because the configuration file path can be defined - self.config = Config(args.conf_file) - - # Debug mode + def init_debug(self, args): + """Init Glances debug mode.""" if args.debug: - from logging import DEBUG - logger.setLevel(DEBUG) else: - from warnings import simplefilter - simplefilter("ignore") - # Plugins refresh rate + def init_refresh_rate(self, args): + """Init Glances refresh rate""" if self.config.has_section('global'): global_refresh = self.config.get_float_value('global', 'refresh', default=self.DEFAULT_REFRESH_TIME) else: global_refresh = self.DEFAULT_REFRESH_TIME - # The configuration key can be overwrite from the command line + + # The configuration key can be overwrite from the command line (-t