diff --git a/conf/glances.conf b/conf/glances.conf index 0e683825..50529875 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -127,7 +127,7 @@ user_careful=50 user_warning=70 user_critical=90 user_log=False -#user_critical_action=echo {{user}} {{value}} {{max}} > /tmp/cpu.alert +#user_critical_action=echo "{{time}} User CPU {{user}} higher than {{critical}}" > /tmp/cpu.alert # system_careful=50 system_warning=70 @@ -186,9 +186,9 @@ disable=False # Define RAM thresholds in % # Default values if not defined: 50/70/90 careful=50 -#careful_action_repeat=echo {{percent}} >> /tmp/memory.alert warning=70 critical=90 +#critical_action_repeat=echo "{{time}} {{percent}} higher than {{critical}}"" >> /tmp/memory.alert [memswap] disable=False @@ -197,6 +197,7 @@ disable=False careful=50 warning=70 critical=90 +#warning_action=echo "{{time}} {{percent}} higher than {{warning}}"" > /tmp/memory.alert [load] disable=False @@ -243,8 +244,9 @@ hide_zero=False #wlan0_tx_warning=900000 #wlan0_tx_critical=1000000 #wlan0_tx_log=True +#wlan0_rx_critical_action=echo "{{time}} {{interface_name}} RX {{bytes_recv_rate_per_sec}}Bps" > /tmp/network.alert # Alias for network interface name -#alias=wlp2s0:WIFI +#alias=wlp0s20f3:WIFI [ip] # Disable display of private IP address @@ -337,11 +339,15 @@ hide=/boot.*,.*/snap.* #show=/,/srv # Define filesystem space thresholds in % # Default values if not defined: 50/70/90 -# It is also possible to define per mount point value -# Example: /_careful=40 careful=50 warning=70 critical=90 +# It is also possible to define per mount point value +# Example: /_careful=40 +#/_careful=1 +#/_warning=5 +#/_critical=10 +#/_critical_action=echo "{{time}} {{mnt_point}} filesystem space {{percent}}% higher than {{critical}}%" > /tmp/fs.alert # Allow additional file system types (comma-separated FS type) #allow=shm # Alias for root file system @@ -412,10 +418,11 @@ hide=unknown.* # Sensors core thresholds (in Celsius...) # By default values are grabbed from the system # Overwrite thresholds for a specific sensor -#temperature_core_Ambient_careful=45 -#temperature_core_Ambient_warning=65 -#temperature_core_Ambient_critical=80 -#temperature_core_Ambient_log=False +# temperature_core_Ambient_careful=40 +# temperature_core_Ambient_warning=60 +# temperature_core_Ambient_critical=85 +# temperature_core_Ambient_log=True +# temperature_core_Ambient_critical_action=echo "{{time}} {{label}} temperature {{value}}{{unit}} higher than {{critical}}{{unit}}" > /tmp/temperature.alert # Overwrite thresholds for a specific type of sensor #temperature_core_careful=45 #temperature_core_warning=65 diff --git a/docker-compose/glances.conf b/docker-compose/glances.conf index e11f1eae..f6b032ab 100755 --- a/docker-compose/glances.conf +++ b/docker-compose/glances.conf @@ -127,7 +127,7 @@ user_careful=50 user_warning=70 user_critical=90 user_log=False -#user_critical_action=echo {{user}} {{value}} {{max}} > /tmp/cpu.alert +#user_critical_action=echo "{{time}} User CPU {{user}} higher than {{critical}}" > /tmp/cpu.alert # system_careful=50 system_warning=70 @@ -186,9 +186,9 @@ disable=False # Define RAM thresholds in % # Default values if not defined: 50/70/90 careful=50 -#careful_action_repeat=echo {{percent}} >> /tmp/memory.alert warning=70 critical=90 +#critical_action_repeat=echo "{{time}} {{percent}} higher than {{critical}}"" >> /tmp/memory.alert [memswap] disable=False @@ -197,6 +197,7 @@ disable=False careful=50 warning=70 critical=90 +#warning_action=echo "{{time}} {{percent}} higher than {{warning}}"" > /tmp/memory.alert [load] disable=False @@ -243,8 +244,9 @@ hide_zero=False #wlan0_tx_warning=900000 #wlan0_tx_critical=1000000 #wlan0_tx_log=True +#wlan0_rx_critical_action=echo "{{time}} {{interface_name}} RX {{bytes_recv_rate_per_sec}}Bps" > /tmp/network.alert # Alias for network interface name -#alias=wlp2s0:WIFI +#alias=wlp0s20f3:WIFI [ip] # Disable display of private IP address @@ -337,11 +339,15 @@ hide=/boot.*,.*/snap.* #show=/,/srv # Define filesystem space thresholds in % # Default values if not defined: 50/70/90 -# It is also possible to define per mount point value -# Example: /_careful=40 careful=50 warning=70 critical=90 +# It is also possible to define per mount point value +# Example: /_careful=40 +#/_careful=1 +#/_warning=5 +#/_critical=10 +#/_critical_action=echo "{{time}} {{mnt_point}} filesystem space {{percent}}% higher than {{critical}}%" > /tmp/fs.alert # Allow additional file system types (comma-separated FS type) #allow=shm # Alias for root file system @@ -412,10 +418,11 @@ hide=unknown.* # Sensors core thresholds (in Celsius...) # By default values are grabbed from the system # Overwrite thresholds for a specific sensor -#temperature_core_Ambient_careful=45 -#temperature_core_Ambient_warning=65 -#temperature_core_Ambient_critical=80 -#temperature_core_Ambient_log=False +# temperature_core_Ambient_careful=40 +# temperature_core_Ambient_warning=60 +# temperature_core_Ambient_critical=85 +# temperature_core_Ambient_log=True +# temperature_core_Ambient_critical_action=echo "{{time}} {{label}} temperature {{value}}{{unit}} higher than {{critical}}{{unit}}" > /tmp/temperature.alert # Overwrite thresholds for a specific type of sensor #temperature_core_careful=45 #temperature_core_warning=65 diff --git a/docs/aoa/actions.rst b/docs/aoa/actions.rst index 736dd29d..164092ed 100644 --- a/docs/aoa/actions.rst +++ b/docs/aoa/actions.rst @@ -3,10 +3,7 @@ Actions ======= -Glances can trigger actions on events. - -For the moment, action can only triggered on plugins that have the _log feature (CPU, MEM, SWAP, LOAD). -An issue (https://github.com/nicolargo/glances/issues/3324) is opened to extend this feature to all plugins. +Glances can trigger actions on events for warning and critical thresholds. By ``action``, we mean all shell command line. For example, if you want to execute the ``foo.py`` script if the last 5 minutes load are critical @@ -21,6 +18,13 @@ then add the ``_action`` line to the Glances configuration file: All the stats are available in the command line through the use of the `Mustache`_ syntax. `Chevron`_ is required to render the mustache's template syntax. +Additionaly to the stats of the current plugin, the following variables are +also available: +- ``{{time}}``: current time in ISO format +- ``{{critical}}``: critical threshold value +- ``{{warning}}``: warning threshold value +- ``{{careful}}``: careful threshold value + Another example would be to create a log file containing used vs total disk space if a space trigger warning is reached: @@ -29,7 +33,7 @@ reached: [fs] warning=70 - warning_action=echo {{mnt_point}} {{used}}/{{size}} > /tmp/fs.alert + warning_action=echo "{{time}} {{mnt_point}} {{used}}/{{size}}" > /tmp/fs.alert A last example would be to create a log file containing the total user disk space usage for a device and notify by email each time a space trigger @@ -39,13 +43,11 @@ critical is reached: [fs] critical=90 - critical_action_repeat=echo {{device_name}} {{percent}} > /tmp/fs.alert && python /etc/glances/actions.d/fs-critical.py - + critical_action_repeat=echo "{{time}} {{device_name}} {{percent}}" > /tmp/fs.alert && python /etc/glances/actions.d/fs-critical.py .. note:: Use && as separator for multiple commands - Within ``/etc/glances/actions.d/fs-critical.py``: .. code-block:: python diff --git a/docs/api/python.rst b/docs/api/python.rst index e5549c87..860a3b1b 100644 --- a/docs/api/python.rst +++ b/docs/api/python.rst @@ -22,25 +22,25 @@ use the following code: >>> gl = api.GlancesAPI() >>> gl.cpu {'cpucore': 16, - 'ctx_switches': 52533492, + 'ctx_switches': 152621677, 'guest': 0.0, - 'idle': 93.2, - 'interrupts': 50900869, + 'idle': 91.3, + 'interrupts': 145959183, 'iowait': 0.3, 'irq': 0.0, 'nice': 0.0, - 'soft_interrupts': 19822005, + 'soft_interrupts': 54857432, 'steal': 0.0, 'syscalls': 0, - 'system': 4.3, - 'total': 7.1, - 'user': 2.1} + 'system': 4.9, + 'total': 8.6, + 'user': 3.4} >>> gl.cpu["total"] - 7.1 + 8.6 >>> gl.mem["used"] - 11813809432 + 12377378072 >>> gl.auto_unit(gl.mem["used"]) - 11.0G + 11.5G If the stats return a list of items (like network interfaces or processes), you can access them by their name: @@ -51,19 +51,19 @@ access them by their name: ['wlp0s20f3'] >>> gl.network["wlp0s20f3"] {'alias': None, - 'bytes_all': 174, - 'bytes_all_gauge': 550670238, - 'bytes_all_rate_per_sec': 527.0, - 'bytes_recv': 60, - 'bytes_recv_gauge': 395984813, - 'bytes_recv_rate_per_sec': 181.0, - 'bytes_sent': 114, - 'bytes_sent_gauge': 154685425, - 'bytes_sent_rate_per_sec': 345.0, + 'bytes_all': 213, + 'bytes_all_gauge': 3919383210, + 'bytes_all_rate_per_sec': 641.0, + 'bytes_recv': 127, + 'bytes_recv_gauge': 3497331262, + 'bytes_recv_rate_per_sec': 382.0, + 'bytes_sent': 86, + 'bytes_sent_gauge': 422051948, + 'bytes_sent_rate_per_sec': 258.0, 'interface_name': 'wlp0s20f3', 'key': 'interface_name', 'speed': 0, - 'time_since_update': 0.32990479469299316} + 'time_since_update': 0.33212876319885254} Init Glances Python API ----------------------- @@ -95,19 +95,32 @@ Alert stats: >>> type(gl.alert) >>> gl.alert - [{'avg': 71.95728229605754, - 'begin': 1762589364, + [{'avg': 70.82879145506998, + 'begin': 1762626147, 'count': 2, 'desc': '', 'end': -1, - 'global_msg': 'High memory consumption', - 'max': 71.97944222716099, - 'min': 71.93512236495411, + 'global_msg': 'EVENTS history', + 'max': 70.82879145506998, + 'min': 70.82879145506998, 'sort': 'memory_percent', 'state': 'WARNING', - 'sum': 143.91456459211508, + 'sum': 141.65758291013995, 'top': [], - 'type': 'MEM'}] + 'type': 'MEMSWAP_'}, + {'avg': 75.33036799351177, + 'begin': 1762626147, + 'count': 2, + 'desc': '', + 'end': -1, + 'global_msg': 'EVENTS history', + 'max': 75.36673172963874, + 'min': 75.2940042573848, + 'sort': 'memory_percent', + 'state': 'WARNING', + 'sum': 150.66073598702354, + 'top': [], + 'type': 'MEM_'}] Alert fields description: @@ -148,7 +161,7 @@ Ports stats: 'port': 0, 'refresh': 30, 'rtt_warning': None, - 'status': 0.009313, + 'status': 0.006071, 'timeout': 3}] Ports fields description: @@ -189,14 +202,14 @@ Diskio stats: >>> gl.diskio["nvme0n1"] {'disk_name': 'nvme0n1', 'key': 'disk_name', - 'read_bytes': 6793828864, - 'read_count': 246383, + 'read_bytes': 13189826048, + 'read_count': 682292, 'read_latency': 0, - 'read_time': 40693, - 'write_bytes': 4888265728, - 'write_count': 301574, + 'read_time': 123469, + 'write_bytes': 19946804224, + 'write_count': 1659358, 'write_latency': 0, - 'write_time': 363298} + 'write_time': 1280478} Diskio fields description: @@ -307,7 +320,7 @@ Processcount stats: >>> type(gl.processcount) >>> gl.processcount - {'pid_max': 0, 'running': 1, 'sleeping': 416, 'thread': 2217, 'total': 568} + {'pid_max': 0, 'running': 1, 'sleeping': 419, 'thread': 2312, 'total': 568} >>> gl.processcount.keys() ['total', 'running', 'sleeping', 'thread', 'pid_max'] >>> gl.processcount["total"] @@ -384,7 +397,7 @@ Percpu stats: 'dpc': None, 'guest': 0.0, 'guest_nice': 0.0, - 'idle': 42.0, + 'idle': 41.0, 'interrupt': None, 'iowait': 0.0, 'irq': 0.0, @@ -392,8 +405,8 @@ Percpu stats: 'nice': 0.0, 'softirq': 0.0, 'steal': 0.0, - 'system': 7.0, - 'total': 58.0, + 'system': 10.0, + 'total': 59.0, 'user': 0.0} Percpu fields description: @@ -484,18 +497,18 @@ Network stats: >>> gl.network["wlp0s20f3"] {'alias': None, 'bytes_all': 0, - 'bytes_all_gauge': 550670238, + 'bytes_all_gauge': 3919383210, 'bytes_all_rate_per_sec': 0.0, 'bytes_recv': 0, - 'bytes_recv_gauge': 395984813, + 'bytes_recv_gauge': 3497331262, 'bytes_recv_rate_per_sec': 0.0, 'bytes_sent': 0, - 'bytes_sent_gauge': 154685425, + 'bytes_sent_gauge': 422051948, 'bytes_sent_rate_per_sec': 0.0, 'interface_name': 'wlp0s20f3', 'key': 'interface_name', 'speed': 0, - 'time_since_update': 0.002383708953857422} + 'time_since_update': 0.0025780200958251953} Network fields description: @@ -536,23 +549,23 @@ Cpu stats: >>> gl.cpu {'cpucore': 16, - 'ctx_switches': 52533492, + 'ctx_switches': 152621677, 'guest': 0.0, - 'idle': 93.2, - 'interrupts': 50900869, + 'idle': 91.3, + 'interrupts': 145959183, 'iowait': 0.3, 'irq': 0.0, 'nice': 0.0, - 'soft_interrupts': 19822005, + 'soft_interrupts': 54857432, 'steal': 0.0, 'syscalls': 0, - 'system': 4.3, - 'total': 7.1, - 'user': 2.1} + 'system': 4.9, + 'total': 8.6, + 'user': 3.4} >>> gl.cpu.keys() ['total', 'user', 'nice', 'system', 'idle', 'iowait', 'irq', 'steal', 'guest', 'ctx_switches', 'interrupts', 'soft_interrupts', 'syscalls', 'cpucore'] >>> gl.cpu["total"] - 7.1 + 8.6 Cpu fields description: @@ -624,7 +637,7 @@ Amps stats: 'refresh': 3.0, 'regex': True, 'result': None, - 'timer': 0.2954432964324951} + 'timer': 0.28630590438842773} Amps fields description: @@ -655,7 +668,7 @@ Processlist stats: >>> gl.processlist Return a dict of dict with key= >>> gl.processlist.keys() - [11415, 12155, 13003, 6739, 7375, 7237, 11329, 7422, 13039, 8545, 73536, 7383, 5814, 4649, 7391, 51475, 7405, 8742, 2968, 11209, 7296, 27324, 11413, 12886, 49784, 11414, 11738, 8479, 11758, 11363, 12434, 13333, 11959, 3755, 74457, 75697, 11282, 75025, 75432, 75023, 6025, 6907, 51766, 5933, 12021, 12004, 12005, 11992, 12006, 6229, 11212, 6454, 8140, 11211, 39419, 7246, 2987, 6995, 2643, 7195, 6945, 6458, 75694, 6142, 7151, 6282, 6134, 8910, 6497, 5945, 6546, 7526, 5979, 2974, 6975, 5981, 5925, 6515, 5969, 5446, 3754, 6008, 5977, 5779, 2731, 728, 5666, 2657, 5516, 1, 2669, 2626, 6182, 2662, 3014, 5518, 5496, 6384, 4461, 5513, 2496, 5966, 5973, 5998, 6039, 3519, 3765, 5987, 3697, 5474, 2632, 2955, 2863, 54037, 2654, 5520, 2734, 2836, 6004, 6193, 3826, 6359, 3520, 6002, 51003, 5975, 6244, 5765, 6036, 2838, 2646, 2497, 5589, 784, 2655, 2629, 2495, 6386, 5906, 5815, 6230, 6149, 6132, 6319, 6206, 5531, 2622, 5991, 5968, 5745, 2651, 5777, 6215, 5652, 6253, 5992, 5593, 2639, 6341, 5514, 11739, 11782, 11996, 5749, 2621, 13354, 50191, 2754, 5829, 2494, 2620, 5503, 11226, 2625, 3934, 6998, 2506, 6968, 2649, 75688, 3767, 3775, 3791, 3196, 5600, 3776, 3771, 71295, 75693, 2963, 2504, 2966, 2718, 3197, 3686, 2, 3, 4, 5, 6, 7, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 121, 122, 123, 124, 125, 126, 127, 128, 133, 135, 136, 137, 138, 139, 140, 143, 144, 145, 146, 147, 148, 149, 152, 153, 154, 155, 156, 158, 164, 168, 177, 186, 187, 213, 216, 218, 242, 246, 256, 257, 258, 259, 260, 262, 263, 265, 353, 356, 359, 360, 361, 362, 364, 365, 445, 446, 607, 612, 613, 614, 619, 651, 663, 664, 761, 762, 793, 963, 997, 998, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1162, 1193, 1205, 1345, 1346, 1407, 1414, 1415, 1416, 1417, 1421, 1466, 1475, 1506, 1510, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1923, 1925, 1926, 1927, 1928, 1929, 1930, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2023, 2024, 2025, 2026, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2042, 2043, 2044, 2046, 2047, 2048, 2054, 2055, 3476, 3478, 3803, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 4225, 4508, 4594, 4597, 4607, 4608, 4616, 4647, 5463, 10431, 18896, 18897, 18898, 18925, 19095, 19560, 31982, 49994, 49996, 50001, 50010, 50011, 50031, 50082, 53847, 54352, 56514, 56515, 56837, 57927, 59952, 60762, 61158, 61159, 61160, 61162, 62405, 64533, 65040, 65526, 66055, 66208, 66436, 66707, 67019, 67519, 67532, 67533, 67557, 68270, 68611, 68883, 68924, 69218, 70088, 70450, 70854, 71091, 71191, 71460, 72391, 72428, 73108, 73567, 74179, 74375, 74610, 74797, 75194, 75218, 75658, 75712] + [11415, 12155, 6739, 13003, 11329, 7237, 7375, 7422, 13039, 190279, 7391, 7405, 79604, 5814, 8545, 7383, 97061, 4649, 161872, 7296, 187602, 11738, 11413, 3755, 11209, 51475, 11363, 8479, 11414, 12886, 2968, 7246, 11758, 201820, 204880, 12005, 13333, 11959, 204488, 202599, 203287, 12434, 12021, 11282, 12004, 190100, 6995, 6907, 11212, 6025, 8140, 39419, 11211, 7195, 204877, 6229, 6454, 8910, 5933, 6458, 6142, 7151, 6945, 11992, 6282, 5518, 2643, 6134, 5979, 6546, 6497, 5945, 5981, 2987, 5779, 12006, 6975, 2731, 5969, 5925, 728, 6008, 2974, 3754, 5977, 1, 5666, 2669, 5516, 5496, 3014, 2657, 6182, 2662, 6384, 2626, 2632, 5513, 7526, 54037, 5973, 2496, 5998, 5987, 6039, 5474, 6515, 3697, 2955, 5520, 2734, 6004, 5966, 2863, 6359, 2654, 3826, 2836, 3765, 5975, 6244, 6002, 6193, 5589, 2838, 2646, 51003, 784, 2655, 2629, 2497, 5906, 5815, 2495, 5531, 5765, 6036, 6230, 6319, 6206, 5991, 2622, 13354, 6149, 6132, 5968, 2651, 5745, 6215, 6253, 5777, 5652, 5593, 5992, 2639, 3519, 6341, 6386, 5514, 5749, 5446, 144633, 2621, 189605, 4461, 11996, 2754, 5829, 2620, 2494, 3520, 11782, 2625, 3934, 6998, 2506, 204873, 2649, 11226, 3767, 3775, 3791, 6968, 5503, 5600, 3776, 156437, 3771, 176753, 204876, 2963, 3196, 2504, 2966, 11739, 2718, 3686, 3197, 2, 3, 4, 5, 6, 7, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 121, 122, 123, 124, 125, 126, 127, 128, 133, 135, 136, 137, 138, 139, 140, 143, 144, 145, 146, 147, 148, 149, 152, 153, 154, 155, 156, 164, 177, 186, 187, 213, 216, 218, 242, 246, 256, 257, 258, 259, 260, 262, 263, 265, 353, 356, 359, 360, 361, 362, 365, 445, 446, 607, 612, 613, 614, 619, 663, 664, 761, 762, 793, 963, 997, 998, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1162, 1193, 1205, 1345, 1346, 1407, 1414, 1415, 1416, 1417, 1466, 1475, 1506, 1510, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1923, 1925, 1926, 1927, 1928, 1929, 1930, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2023, 2024, 2025, 2026, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2042, 2043, 2044, 2046, 2047, 2048, 2054, 2055, 3476, 3478, 3803, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 4225, 4508, 4594, 4597, 4607, 4608, 4616, 4647, 5463, 18896, 18897, 18898, 18925, 19095, 112706, 160981, 172358, 173690, 174162, 176103, 177430, 177915, 179801, 180836, 181997, 183066, 184446, 185352, 185614, 185999, 186082, 186459, 187691, 187693, 189483, 189484, 189490, 189504, 189515, 189517, 189518, 189520, 189525, 189529, 189530, 189534, 190404, 190422, 190447, 190689, 190694, 192467, 193719, 193727, 196367, 196725, 197880, 197996, 198414, 198778, 199309, 200116, 200497, 200725, 201520, 202413, 202544, 202545, 202685, 203415, 203555, 203957, 204325, 204614, 204895] >>> gl.processlist["11415"] {'cmdline': ['/proc/self/exe', '--type=utility', @@ -680,82 +693,82 @@ Processlist stats: '--enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,EarlyEstablishGpuChannel,EstablishGpuChannelAsync', '--disable-features=CalculateNativeWinOcclusion,FontationsLinuxSystemFonts,ScreenAIOCREnabled,SpareRendererForSitePerProcess', '--variations-seed-version'], - 'cpu_percent': 3.5, - 'cpu_times': {'children_system': 158.47, - 'children_user': 218.32, + 'cpu_percent': 0.0, + 'cpu_times': {'children_system': 435.92, + 'children_user': 453.33, 'iowait': 0.0, - 'system': 191.0, - 'user': 907.51}, + 'system': 552.83, + 'user': 4699.49}, 'gids': {'effective': 1000, 'real': 1000, 'saved': 1000}, - 'io_counters': [878424064, - 340512768, - 878424064, - 340512768, + 'io_counters': [1491209216, + 1474269184, + 1491209216, + 1474269184, 1, - 56623104, - 1708032, - 56623104, - 1708032, + 133365760, + 2252800, + 133365760, + 2252800, 1, - 24398848, - 131072, - 24398848, - 131072, + 45949952, + 188416, + 45949952, + 188416, 1, - 77263872, + 82961408, 0, - 77263872, + 82961408, 0, 1, - 79174656, - 25894912, - 79174656, - 25894912, - 1, - 32010240, - 184020992, - 32010240, - 184020992, - 1, - 15147008, + 10279936, 0, - 15147008, + 10279936, 0, 1, - 33863680, + 47232000, + 184909824, + 47232000, + 184909824, + 1, + 88373248, + 72253440, + 88373248, + 72253440, + 1, + 3109888, 0, - 33863680, + 3109888, 0, 1, - 9763840, + 37914624, 0, - 9763840, + 37914624, 0, 1, - 659456, + 15155200, 0, - 659456, + 15155200, 0, 1, - 2506752, + 937984, 0, - 2506752, + 937984, 0, 1, - 4743168, + 1199104, 0, - 4743168, + 1199104, 0, 1, - 117760, + 5255168, 0, - 117760, + 5255168, 0, 1, - 3310592, - 2273280, - 3310592, - 2273280, + 5059584, + 5652480, + 5059584, + 5652480, 1, 1364992, 0, @@ -768,20 +781,20 @@ Processlist stats: 0, 1], 'key': 'pid', - 'memory_info': {'data': 3776540672, + 'memory_info': {'data': 5951479808, 'dirty': 0, 'lib': 0, - 'rss': 2240790528, - 'shared': 131801088, + 'rss': 3487985664, + 'shared': 101527552, 'text': 148733952, - 'vms': 1526371254272}, - 'memory_percent': 13.644332232860595, + 'vms': 1526405382144}, + 'memory_percent': 21.23859175071936, 'name': 'code', 'nice': 0, - 'num_threads': 62, + 'num_threads': 96, 'pid': 11415, 'status': 'S', - 'time_since_update': 0.6012001037597656, + 'time_since_update': 0.6125757694244385, 'username': 'nicolargo'} Processlist fields description: @@ -865,11 +878,14 @@ Load stats: >>> type(gl.load) >>> gl.load - {'cpucore': 16, 'min1': 0.828125, 'min15': 0.94384765625, 'min5': 0.88525390625} + {'cpucore': 16, + 'min1': 1.4365234375, + 'min15': 1.5400390625, + 'min5': 1.4931640625} >>> gl.load.keys() ['min1', 'min5', 'min15', 'cpucore'] >>> gl.load["min1"] - 0.828125 + 1.4365234375 Load fields description: @@ -908,7 +924,7 @@ Sensors stats: 'label': 'Ambient', 'type': 'temperature_core', 'unit': 'C', - 'value': 33, + 'value': 36, 'warning': 0} Sensors fields description: @@ -946,7 +962,7 @@ Uptime stats: >>> type(gl.uptime) >>> gl.uptime - '3 days, 11:17:55' + '3 days, 21:30:55' Uptime limits: @@ -965,11 +981,11 @@ Now stats: >>> type(gl.now) >>> gl.now - {'custom': '2025-11-08 09:09:25 CET', 'iso': '2025-11-08T09:09:25+01:00'} + {'custom': '2025-11-08 19:22:27 CET', 'iso': '2025-11-08T19:22:27+01:00'} >>> gl.now.keys() ['iso', 'custom'] >>> gl.now["iso"] - '2025-11-08T09:09:25+01:00' + '2025-11-08T19:22:27+01:00' Now fields description: @@ -998,14 +1014,14 @@ Fs stats: ['/', '/zsfpool'] >>> gl.fs["/"] {'device_name': '/dev/mapper/ubuntu--vg-ubuntu--lv', - 'free': 710579105792, + 'free': 706833158144, 'fs_type': 'ext4', 'key': 'mnt_point', 'mnt_point': '/', 'options': 'rw,relatime', - 'percent': 25.4, + 'percent': 25.8, 'size': 1003736440832, - 'used': 242094829568} + 'used': 245840777216} Fs fields description: @@ -1045,8 +1061,8 @@ Wifi stats: ['wlp0s20f3'] >>> gl.wifi["wlp0s20f3"] {'key': 'ssid', - 'quality_level': -66.0, - 'quality_link': 44.0, + 'quality_level': -61.0, + 'quality_link': 49.0, 'ssid': 'wlp0s20f3'} Wifi limits: @@ -1070,7 +1086,7 @@ Ip stats: >>> type(gl.ip) >>> gl.ip - {'address': '192.168.1.31', + {'address': '192.168.1.26', 'mask': '255.255.255.0', 'mask_cidr': 24, 'public_address': '', @@ -1078,7 +1094,7 @@ Ip stats: >>> gl.ip.keys() ['address', 'mask', 'mask_cidr', 'public_address', 'public_info_human'] >>> gl.ip["address"] - '192.168.1.31' + '192.168.1.26' Ip fields description: @@ -1178,16 +1194,16 @@ Mem stats: >>> type(gl.mem) >>> gl.mem - {'active': 4790829056, - 'available': 4609057512, - 'buffers': 160555008, - 'cached': 4114652008, - 'free': 973725696, - 'inactive': 9211170816, - 'percent': 71.9, - 'shared': 681201664, + {'active': 7521083392, + 'available': 4045488872, + 'buffers': 115896320, + 'cached': 4140108648, + 'free': 649314304, + 'inactive': 6018564096, + 'percent': 75.4, + 'shared': 768061440, 'total': 16422866944, - 'used': 11813809432} + 'used': 12377378072} >>> gl.mem.keys() ['total', 'available', 'percent', 'used', 'free', 'active', 'inactive', 'buffers', 'cached', 'shared'] >>> gl.mem["total"] @@ -1257,19 +1273,19 @@ Quicklook stats: >>> type(gl.quicklook) >>> gl.quicklook - {'cpu': 7.1, + {'cpu': 8.6, 'cpu_hz': 4475000000.0, - 'cpu_hz_current': 707172000.0, + 'cpu_hz_current': 786058312.5, 'cpu_log_core': 16, 'cpu_name': '13th Gen Intel(R) Core(TM) i7-13620H', 'cpu_phys_core': 10, - 'load': 5.9, - 'mem': 71.9, + 'load': 9.6, + 'mem': 75.4, 'percpu': [{'cpu_number': 0, 'dpc': None, 'guest': 0.0, 'guest_nice': 0.0, - 'idle': 42.0, + 'idle': 41.0, 'interrupt': None, 'iowait': 0.0, 'irq': 0.0, @@ -1277,14 +1293,14 @@ Quicklook stats: 'nice': 0.0, 'softirq': 0.0, 'steal': 0.0, - 'system': 7.0, - 'total': 58.0, + 'system': 10.0, + 'total': 59.0, 'user': 0.0}, {'cpu_number': 1, 'dpc': None, 'guest': 0.0, 'guest_nice': 0.0, - 'idle': 52.0, + 'idle': 48.0, 'interrupt': None, 'iowait': 0.0, 'irq': 0.0, @@ -1293,28 +1309,13 @@ Quicklook stats: 'softirq': 0.0, 'steal': 0.0, 'system': 0.0, - 'total': 48.0, - 'user': 0.0}, + 'total': 52.0, + 'user': 2.0}, {'cpu_number': 2, 'dpc': None, 'guest': 0.0, 'guest_nice': 0.0, - 'idle': 49.0, - 'interrupt': None, - 'iowait': 0.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 0.0, - 'softirq': 0.0, - 'steal': 0.0, - 'system': 1.0, - 'total': 51.0, - 'user': 3.0}, - {'cpu_number': 3, - 'dpc': None, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 53.0, + 'idle': 51.0, 'interrupt': None, 'iowait': 0.0, 'irq': 0.0, @@ -1323,24 +1324,9 @@ Quicklook stats: 'softirq': 0.0, 'steal': 0.0, 'system': 0.0, - 'total': 47.0, - 'user': 0.0}, - {'cpu_number': 4, - 'dpc': None, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 29.0, - 'interrupt': None, - 'iowait': 1.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 0.0, - 'softirq': 0.0, - 'steal': 0.0, - 'system': 12.0, - 'total': 71.0, - 'user': 10.0}, - {'cpu_number': 5, + 'total': 49.0, + 'user': 1.0}, + {'cpu_number': 3, 'dpc': None, 'guest': 0.0, 'guest_nice': 0.0, @@ -1355,37 +1341,22 @@ Quicklook stats: 'system': 2.0, 'total': 50.0, 'user': 1.0}, - {'cpu_number': 6, + {'cpu_number': 4, 'dpc': None, 'guest': 0.0, 'guest_nice': 0.0, - 'idle': 44.0, + 'idle': 19.0, 'interrupt': None, - 'iowait': 0.0, + 'iowait': 2.0, 'irq': 0.0, 'key': 'cpu_number', 'nice': 0.0, 'softirq': 0.0, 'steal': 0.0, - 'system': 5.0, - 'total': 56.0, - 'user': 3.0}, - {'cpu_number': 7, - 'dpc': None, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 44.0, - 'interrupt': None, - 'iowait': 0.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 0.0, - 'softirq': 0.0, - 'steal': 0.0, - 'system': 5.0, - 'total': 56.0, - 'user': 2.0}, - {'cpu_number': 8, + 'system': 16.0, + 'total': 81.0, + 'user': 14.0}, + {'cpu_number': 5, 'dpc': None, 'guest': 0.0, 'guest_nice': 0.0, @@ -1397,9 +1368,54 @@ Quicklook stats: 'nice': 0.0, 'softirq': 0.0, 'steal': 0.0, - 'system': 1.0, + 'system': 0.0, 'total': 48.0, 'user': 0.0}, + {'cpu_number': 6, + 'dpc': None, + 'guest': 0.0, + 'guest_nice': 0.0, + 'idle': 42.0, + 'interrupt': None, + 'iowait': 0.0, + 'irq': 0.0, + 'key': 'cpu_number', + 'nice': 0.0, + 'softirq': 0.0, + 'steal': 0.0, + 'system': 8.0, + 'total': 58.0, + 'user': 1.0}, + {'cpu_number': 7, + 'dpc': None, + 'guest': 0.0, + 'guest_nice': 0.0, + 'idle': 50.0, + 'interrupt': None, + 'iowait': 0.0, + 'irq': 0.0, + 'key': 'cpu_number', + 'nice': 0.0, + 'softirq': 0.0, + 'steal': 0.0, + 'system': 2.0, + 'total': 50.0, + 'user': 1.0}, + {'cpu_number': 8, + 'dpc': None, + 'guest': 0.0, + 'guest_nice': 0.0, + 'idle': 49.0, + 'interrupt': None, + 'iowait': 0.0, + 'irq': 0.0, + 'key': 'cpu_number', + 'nice': 0.0, + 'softirq': 0.0, + 'steal': 0.0, + 'system': 2.0, + 'total': 51.0, + 'user': 2.0}, {'cpu_number': 9, 'dpc': None, 'guest': 0.0, @@ -1421,20 +1437,20 @@ Quicklook stats: 'guest_nice': 0.0, 'idle': 50.0, 'interrupt': None, - 'iowait': 0.0, + 'iowait': 1.0, 'irq': 0.0, 'key': 'cpu_number', 'nice': 0.0, 'softirq': 0.0, 'steal': 0.0, - 'system': 3.0, + 'system': 1.0, 'total': 50.0, 'user': 1.0}, {'cpu_number': 11, 'dpc': None, 'guest': 0.0, 'guest_nice': 0.0, - 'idle': 53.0, + 'idle': 52.0, 'interrupt': None, 'iowait': 0.0, 'irq': 0.0, @@ -1443,54 +1459,9 @@ Quicklook stats: 'softirq': 0.0, 'steal': 0.0, 'system': 0.0, - 'total': 47.0, - 'user': 0.0}, + 'total': 48.0, + 'user': 1.0}, {'cpu_number': 12, - 'dpc': None, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 50.0, - 'interrupt': None, - 'iowait': 0.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 0.0, - 'softirq': 0.0, - 'steal': 0.0, - 'system': 2.0, - 'total': 50.0, - 'user': 1.0}, - {'cpu_number': 13, - 'dpc': None, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 52.0, - 'interrupt': None, - 'iowait': 0.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 0.0, - 'softirq': 0.0, - 'steal': 0.0, - 'system': 0.0, - 'total': 48.0, - 'user': 1.0}, - {'cpu_number': 14, - 'dpc': None, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 52.0, - 'interrupt': None, - 'iowait': 0.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 0.0, - 'softirq': 0.0, - 'steal': 0.0, - 'system': 0.0, - 'total': 48.0, - 'user': 0.0}, - {'cpu_number': 15, 'dpc': None, 'guest': 0.0, 'guest_nice': 0.0, @@ -1504,8 +1475,53 @@ Quicklook stats: 'steal': 0.0, 'system': 1.0, 'total': 49.0, - 'user': 1.0}], - 'swap': 1.2} + 'user': 0.0}, + {'cpu_number': 13, + 'dpc': None, + 'guest': 0.0, + 'guest_nice': 0.0, + 'idle': 50.0, + 'interrupt': None, + 'iowait': 0.0, + 'irq': 0.0, + 'key': 'cpu_number', + 'nice': 0.0, + 'softirq': 0.0, + 'steal': 0.0, + 'system': 1.0, + 'total': 50.0, + 'user': 1.0}, + {'cpu_number': 14, + 'dpc': None, + 'guest': 0.0, + 'guest_nice': 0.0, + 'idle': 50.0, + 'interrupt': None, + 'iowait': 1.0, + 'irq': 0.0, + 'key': 'cpu_number', + 'nice': 0.0, + 'softirq': 0.0, + 'steal': 0.0, + 'system': 1.0, + 'total': 50.0, + 'user': 2.0}, + {'cpu_number': 15, + 'dpc': None, + 'guest': 0.0, + 'guest_nice': 0.0, + 'idle': 51.0, + 'interrupt': None, + 'iowait': 0.0, + 'irq': 0.0, + 'key': 'cpu_number', + 'nice': 0.0, + 'softirq': 0.0, + 'steal': 0.0, + 'system': 0.0, + 'total': 49.0, + 'user': 2.0}], + 'swap': 70.8} >>> gl.quicklook.keys() ['cpu_name', 'cpu_hz_current', 'cpu_hz', 'cpu', 'percpu', 'mem', 'swap', 'cpu_log_core', 'cpu_phys_core', 'load'] >>> gl.quicklook["cpu_name"] @@ -1555,13 +1571,13 @@ Memswap stats: >>> type(gl.memswap) >>> gl.memswap - {'free': 4242575360, - 'percent': 1.2, - 'sin': 14905344, - 'sout': 50098176, - 'time_since_update': 0.6806409358978271, + {'free': 1252892672, + 'percent': 70.8, + 'sin': 744210432, + 'sout': 3408969728, + 'time_since_update': 0.6786904335021973, 'total': 4294963200, - 'used': 52387840} + 'used': 3042070528} >>> gl.memswap.keys() ['total', 'used', 'free', 'percent', 'sin', 'sout', 'time_since_update'] >>> gl.memswap["total"] @@ -1596,10 +1612,10 @@ Use auto_unit() function to generate a human-readable string with the unit: .. code-block:: python >>> gl.mem["used"] - 11813809432 + 12377378072 >>> gl.auto_unit(gl.mem["used"]) - 11.0G + 11.5G Args: @@ -1655,7 +1671,7 @@ Use top_process() function to generate a list of top processes sorted by CPU or .. code-block:: python >>> gl.top_process() - [{'memory_percent': 13.644332232860595, 'status': 'S', 'gids': {'real': 1000, 'effective': 1000, 'saved': 1000}, 'num_threads': 62, 'pid': 11415, 'name': 'code', 'memory_info': {'rss': 2240790528, 'vms': 1526371254272, 'shared': 131801088, 'text': 148733952, 'lib': 0, 'data': 3776540672, 'dirty': 0}, 'nice': 0, 'io_counters': [878424064, 340512768, 878424064, 340512768, 1, 56623104, 1708032, 56623104, 1708032, 1, 24398848, 131072, 24398848, 131072, 1, 77263872, 0, 77263872, 0, 1, 79174656, 25894912, 79174656, 25894912, 1, 32010240, 184020992, 32010240, 184020992, 1, 15147008, 0, 15147008, 0, 1, 33863680, 0, 33863680, 0, 1, 9763840, 0, 9763840, 0, 1, 659456, 0, 659456, 0, 1, 2506752, 0, 2506752, 0, 1, 4743168, 0, 4743168, 0, 1, 117760, 0, 117760, 0, 1, 3310592, 2273280, 3310592, 2273280, 1, 1364992, 0, 1364992, 0, 1, 1082368, 0, 1082368, 0, 1], 'cpu_times': {'user': 907.51, 'system': 191.0, 'children_user': 218.32, 'children_system': 158.47, 'iowait': 0.0}, 'cpu_percent': 3.5, 'key': 'pid', 'time_since_update': 0.6012001037597656, 'cmdline': ['/proc/self/exe', '--type=utility', '--utility-sub-type=node.mojom.NodeService', '--lang=en-US', '--service-sandbox-type=none', '--no-sandbox', '--dns-result-order=ipv4first', '--experimental-network-inspection', '--inspect-port=0', '--crashpad-handler-pid=11226', '--enable-crash-reporter=864d4bb7-dd20-4851-830f-29e81dd93517,no_channel', '--user-data-dir=/home/nicolargo/.config/Code', '--standard-schemes=vscode-webview,vscode-file', '--secure-schemes=vscode-webview,vscode-file', '--cors-schemes=vscode-webview,vscode-file', '--fetch-schemes=vscode-webview,vscode-file', '--service-worker-schemes=vscode-webview', '--code-cache-schemes=vscode-webview,vscode-file', '--shared-files=v8_context_snapshot_data:100', '--field-trial-handle=3,i,1837833807548475681,9806205746640435922,262144', '--enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,EarlyEstablishGpuChannel,EstablishGpuChannelAsync', '--disable-features=CalculateNativeWinOcclusion,FontationsLinuxSystemFonts,ScreenAIOCREnabled,SpareRendererForSitePerProcess', '--variations-seed-version'], 'username': 'nicolargo'}, {'memory_percent': 4.721100369648102, 'status': 'S', 'gids': {'real': 1000, 'effective': 1000, 'saved': 1000}, 'num_threads': 156, 'pid': 6739, 'name': 'firefox', 'memory_info': {'rss': 775340032, 'vms': 21607829504, 'shared': 285663232, 'text': 610304, 'lib': 0, 'data': 1131827200, 'dirty': 0}, 'nice': 0, 'io_counters': [782317568, 1437470720, 782317568, 1437470720, 1], 'cpu_times': {'user': 612.37, 'system': 166.92, 'children_user': 0.22, 'children_system': 0.78, 'iowait': 0.0}, 'cpu_percent': 1.7, 'key': 'pid', 'time_since_update': 0.6012001037597656, 'cmdline': ['/snap/firefox/7177/usr/lib/firefox/firefox'], 'username': 'nicolargo'}, {'memory_percent': 2.839239613826101, 'status': 'S', 'gids': {'real': 1000, 'effective': 1000, 'saved': 1000}, 'num_threads': 32, 'pid': 7422, 'name': 'Isolated Web Co', 'memory_info': {'rss': 466284544, 'vms': 3148947456, 'shared': 115036160, 'text': 610304, 'lib': 0, 'data': 557350912, 'dirty': 0}, 'nice': 0, 'io_counters': [156672, 0, 156672, 0, 1], 'cpu_times': {'user': 355.26, 'system': 30.27, 'children_user': 0.0, 'children_system': 0.0, 'iowait': 0.0}, 'cpu_percent': 1.7, 'key': 'pid', 'time_since_update': 0.6012001037597656, 'cmdline': ['/snap/firefox/7177/usr/lib/firefox/firefox', '-contentproc', '-isForBrowser', '-prefsHandle', '0:34952', '-prefMapHandle', '1:278271', '-jsInitHandle', '2:224660', '-parentBuildID', '20251028100515', '-sandboxReporter', '3', '-chrootClient', '4', '-ipcHandle', '5', '-initialChannelId', '{816ebba5-75b8-45df-9ecc-7ba06c4a2168}', '-parentPid', '6739', '-crashReporter', '6', '-crashHelper', '7', '-greomni', '/snap/firefox/7177/usr/lib/firefox/omni.ja', '-appomni', '/snap/firefox/7177/usr/lib/firefox/browser/omni.ja', '-appDir', '/snap/firefox/7177/usr/lib/firefox/browser', '10', 'tab'], 'username': 'nicolargo'}] + [{'cpu_times': {'user': 142.53, 'system': 28.21, 'children_user': 6.51, 'children_system': 0.92, 'iowait': 0.0}, 'memory_percent': 0.9874076222680747, 'status': 'S', 'memory_info': {'rss': 162160640, 'vms': 1496398196736, 'shared': 81625088, 'text': 148733952, 'lib': 0, 'data': 981913600, 'dirty': 0}, 'num_threads': 20, 'nice': 0, 'cpu_percent': 34.6, 'name': 'code', 'io_counters': [47232000, 184909824, 47232000, 184909824, 1], 'pid': 11413, 'gids': {'real': 1000, 'effective': 1000, 'saved': 1000}, 'key': 'pid', 'time_since_update': 0.6125757694244385, 'cmdline': ['/proc/self/exe', '--type=utility', '--utility-sub-type=node.mojom.NodeService', '--lang=en-US', '--service-sandbox-type=none', '--no-sandbox', '--crashpad-handler-pid=11226', '--enable-crash-reporter=864d4bb7-dd20-4851-830f-29e81dd93517,no_channel', '--user-data-dir=/home/nicolargo/.config/Code', '--standard-schemes=vscode-webview,vscode-file', '--secure-schemes=vscode-webview,vscode-file', '--cors-schemes=vscode-webview,vscode-file', '--fetch-schemes=vscode-webview,vscode-file', '--service-worker-schemes=vscode-webview', '--code-cache-schemes=vscode-webview,vscode-file', '--shared-files=v8_context_snapshot_data:100', '--field-trial-handle=3,i,1837833807548475681,9806205746640435922,262144', '--enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,EarlyEstablishGpuChannel,EstablishGpuChannelAsync', '--disable-features=CalculateNativeWinOcclusion,FontationsLinuxSystemFonts,ScreenAIOCREnabled,SpareRendererForSitePerProcess', '--variations-seed-version'], 'username': 'nicolargo'}, {'cpu_times': {'user': 1434.78, 'system': 412.32, 'children_user': 0.31, 'children_system': 1.31, 'iowait': 0.0}, 'memory_percent': 4.202879718587581, 'status': 'S', 'memory_info': {'rss': 690233344, 'vms': 30284357632, 'shared': 190992384, 'text': 610304, 'lib': 0, 'data': 1229365248, 'dirty': 0}, 'num_threads': 160, 'nice': 0, 'cpu_percent': 3.4, 'name': 'firefox', 'io_counters': [1124296704, 2744606720, 1124296704, 2744606720, 1], 'pid': 6739, 'gids': {'real': 1000, 'effective': 1000, 'saved': 1000}, 'key': 'pid', 'time_since_update': 0.6125757694244385, 'cmdline': ['/snap/firefox/7177/usr/lib/firefox/firefox'], 'username': 'nicolargo'}, {'cpu_times': {'user': 9.94, 'system': 0.98, 'children_user': 0.83, 'children_system': 2.26, 'iowait': 0.0}, 'memory_percent': 1.2074107199196704, 'status': 'S', 'memory_info': {'rss': 198291456, 'vms': 2321494016, 'shared': 54341632, 'text': 3026944, 'lib': 0, 'data': 288841728, 'dirty': 0}, 'num_threads': 29, 'nice': 0, 'cpu_percent': 1.7, 'name': 'protonvpn-app', 'io_counters': [44564480, 115331072, 44564480, 115331072, 1], 'pid': 161872, 'gids': {'real': 1000, 'effective': 1000, 'saved': 1000}, 'key': 'pid', 'time_since_update': 0.6125757694244385, 'cmdline': ['/usr/bin/python3', '/usr/bin/protonvpn-app'], 'username': 'nicolargo'}] Args: diff --git a/docs/api/restful.rst b/docs/api/restful.rst index 9bb72ad1..79537c62 100644 --- a/docs/api/restful.rst +++ b/docs/api/restful.rst @@ -160,7 +160,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.506878137588501}, + "timer": 0.5141401290893555}, {"count": 0, "countmax": 20.0, "countmin": None, @@ -169,7 +169,7 @@ Get plugin stats:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.5067839622497559}] + "timer": 0.5140109062194824}] Fields descriptions: @@ -197,7 +197,7 @@ Get a specific item when field matches the given value:: "refresh": 3.0, "regex": True, "result": None, - "timer": 0.506878137588501}]} + "timer": 0.5141401290893555}]} GET cloud --------- @@ -245,17 +245,17 @@ Get plugin stats:: "engine": "docker", "id": "3bf16da8d0ac1690a7a9fba938ef52d338a9e8db00a8fcba8f707d87e4886471", "image": ["ghcr.io/home-assistant/home-assistant:stable"], - "io": {"cumulative_ior": 244260864, "cumulative_iow": 0}, + "io": {"cumulative_ior": 257855488, "cumulative_iow": 0}, "io_rx": None, "io_wx": None, "key": "name", - "memory": {"inactive_file": 124633088, + "memory": {"inactive_file": 2871296, "limit": 16422866944, - "usage": 454324224}, - "memory_inactive_file": 124633088, + "usage": 247324672}, + "memory_inactive_file": 2871296, "memory_limit": 16422866944, "memory_percent": None, - "memory_usage": 454324224, + "memory_usage": 247324672, "name": "homeassistant", "network": {}, "network_rx": None, @@ -301,17 +301,17 @@ Get a specific item when field matches the given value:: "engine": "docker", "id": "3bf16da8d0ac1690a7a9fba938ef52d338a9e8db00a8fcba8f707d87e4886471", "image": ["ghcr.io/home-assistant/home-assistant:stable"], - "io": {"cumulative_ior": 244260864, "cumulative_iow": 0}, + "io": {"cumulative_ior": 257855488, "cumulative_iow": 0}, "io_rx": None, "io_wx": None, "key": "name", - "memory": {"inactive_file": 124633088, + "memory": {"inactive_file": 2871296, "limit": 16422866944, - "usage": 454324224}, - "memory_inactive_file": 124633088, + "usage": 247324672}, + "memory_inactive_file": 2871296, "memory_limit": 16422866944, "memory_percent": None, - "memory_usage": 454324224, + "memory_usage": 247324672, "name": "homeassistant", "network": {}, "network_rx": None, @@ -345,19 +345,19 @@ Get plugin stats:: # curl http://localhost:61208/api/4/cpu {"cpucore": 16, - "ctx_switches": 52546896, + "ctx_switches": 152640246, "guest": 0.0, - "idle": 93.3, - "interrupts": 50913056, - "iowait": 0.1, + "idle": 92.1, + "interrupts": 145976408, + "iowait": 0.3, "irq": 0.0, "nice": 0.0, - "soft_interrupts": 19829363, + "soft_interrupts": 54867511, "steal": 0.0, "syscalls": 0, "system": 3.1, - "total": 6.0, - "user": 3.6} + "total": 7.2, + "user": 4.4} Fields descriptions: @@ -390,7 +390,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/cpu/total - {"total": 6.0} + {"total": 7.2} GET diskio ---------- @@ -400,20 +400,20 @@ Get plugin stats:: # curl http://localhost:61208/api/4/diskio [{"disk_name": "nvme0n1", "key": "disk_name", - "read_bytes": 6793828864, - "read_count": 246383, + "read_bytes": 13192517120, + "read_count": 682516, "read_latency": 0, - "read_time": 40693, - "write_bytes": 4888531968, - "write_count": 301597, + "read_time": 123557, + "write_bytes": 19947217920, + "write_count": 1659419, "write_latency": 0, - "write_time": 363500}, + "write_time": 1280548}, {"disk_name": "nvme0n1p1", "key": "disk_name", - "read_bytes": 7402496, - "read_count": 578, + "read_bytes": 12962816, + "read_count": 754, "read_latency": 0, - "read_time": 222, + "read_time": 258, "write_bytes": 1024, "write_count": 2, "write_latency": 0, @@ -459,14 +459,14 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/diskio/disk_name/value/nvme0n1 {"nvme0n1": [{"disk_name": "nvme0n1", "key": "disk_name", - "read_bytes": 6793828864, - "read_count": 246383, + "read_bytes": 13192517120, + "read_count": 682516, "read_latency": 0, - "read_time": 40693, - "write_bytes": 4888531968, - "write_count": 301597, + "read_time": 123557, + "write_bytes": 19947217920, + "write_count": 1659419, "write_latency": 0, - "write_time": 363500}]} + "write_time": 1280548}]} GET folders ----------- @@ -493,14 +493,14 @@ Get plugin stats:: # curl http://localhost:61208/api/4/fs [{"device_name": "/dev/mapper/ubuntu--vg-ubuntu--lv", - "free": 710579122176, + "free": 706833186816, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", "options": "rw,relatime", - "percent": 25.4, + "percent": 25.8, "size": 1003736440832, - "used": 242094813184}, + "used": 245840748544}, {"device_name": "zsfpool", "free": 41680896, "fs_type": "zfs", @@ -531,14 +531,14 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/fs/mnt_point/value// {"/": [{"device_name": "/dev/mapper/ubuntu--vg-ubuntu--lv", - "free": 710579122176, + "free": 706833186816, "fs_type": "ext4", "key": "mnt_point", "mnt_point": "/", "options": "rw,relatime", - "percent": 25.4, + "percent": 25.8, "size": 1003736440832, - "used": 242094813184}]} + "used": 245840748544}]} GET gpu ------- @@ -571,7 +571,7 @@ GET ip Get plugin stats:: # curl http://localhost:61208/api/4/ip - {"address": "192.168.1.31", + {"address": "192.168.1.26", "mask": "255.255.255.0", "mask_cidr": 24, "public_address": "", @@ -589,7 +589,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/ip/address - {"address": "192.168.1.31"} + {"address": "192.168.1.26"} GET irq ------- @@ -610,7 +610,10 @@ GET load Get plugin stats:: # curl http://localhost:61208/api/4/load - {"cpucore": 16, "min1": 0.828125, "min15": 0.94384765625, "min5": 0.88525390625} + {"cpucore": 16, + "min1": 1.4365234375, + "min15": 1.5400390625, + "min5": 1.4931640625} Fields descriptions: @@ -622,7 +625,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/load/min1 - {"min1": 0.828125} + {"min1": 1.4365234375} GET mem ------- @@ -630,16 +633,16 @@ GET mem Get plugin stats:: # curl http://localhost:61208/api/4/mem - {"active": 4784877568, - "available": 4593246952, - "buffers": 160563200, - "cached": 4125186920, - "free": 957923328, - "inactive": 9211162624, - "percent": 72.0, - "shared": 691752960, + {"active": 7498133504, + "available": 4075176680, + "buffers": 115937280, + "cached": 4141468520, + "free": 678023168, + "inactive": 6019579904, + "percent": 75.2, + "shared": 767238144, "total": 16422866944, - "used": 11829619992} + "used": 12347690264} Fields descriptions: @@ -666,13 +669,13 @@ GET memswap Get plugin stats:: # curl http://localhost:61208/api/4/memswap - {"free": 4242575360, - "percent": 1.2, - "sin": 14905344, - "sout": 50098176, + {"free": 1253367808, + "percent": 70.8, + "sin": 744689664, + "sout": 3408969728, "time_since_update": 1, "total": 4294963200, - "used": 52387840} + "used": 3041595392} Fields descriptions: @@ -697,18 +700,18 @@ Get plugin stats:: # curl http://localhost:61208/api/4/network [{"alias": None, "bytes_all": 0, - "bytes_all_gauge": 550677061, + "bytes_all_gauge": 3919422149, "bytes_all_rate_per_sec": 0, "bytes_recv": 0, - "bytes_recv_gauge": 395988066, + "bytes_recv_gauge": 3497350662, "bytes_recv_rate_per_sec": 0, "bytes_sent": 0, - "bytes_sent_gauge": 154688995, + "bytes_sent_gauge": 422071487, "bytes_sent_rate_per_sec": 0, "interface_name": "wlp0s20f3", "key": "interface_name", "speed": 0, - "time_since_update": 0.5094969272613525}] + "time_since_update": 0.5178399085998535}] Fields descriptions: @@ -737,18 +740,18 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/network/interface_name/value/wlp0s20f3 {"wlp0s20f3": [{"alias": None, "bytes_all": 0, - "bytes_all_gauge": 550677061, + "bytes_all_gauge": 3919422149, "bytes_all_rate_per_sec": 0, "bytes_recv": 0, - "bytes_recv_gauge": 395988066, + "bytes_recv_gauge": 3497350662, "bytes_recv_rate_per_sec": 0, "bytes_sent": 0, - "bytes_sent_gauge": 154688995, + "bytes_sent_gauge": 422071487, "bytes_sent_rate_per_sec": 0, "interface_name": "wlp0s20f3", "key": "interface_name", "speed": 0, - "time_since_update": 0.5094969272613525}]} + "time_since_update": 0.5178399085998535}]} GET now ------- @@ -756,7 +759,7 @@ GET now Get plugin stats:: # curl http://localhost:61208/api/4/now - {"custom": "2025-11-08 09:09:29 CET", "iso": "2025-11-08T09:09:29+01:00"} + {"custom": "2025-11-08 19:22:32 CET", "iso": "2025-11-08T19:22:32+01:00"} Fields descriptions: @@ -766,7 +769,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/now/iso - {"iso": "2025-11-08T09:09:29+01:00"} + {"iso": "2025-11-08T19:22:32+01:00"} GET percpu ---------- @@ -778,7 +781,7 @@ Get plugin stats:: "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 39.0, + "idle": 40.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -787,13 +790,13 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 8.0, - "total": 61.0, + "total": 60.0, "user": 0.0}, {"cpu_number": 1, "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 49.0, + "idle": 48.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -802,8 +805,8 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 51.0, - "user": 0.0}] + "total": 52.0, + "user": 2.0}] Fields descriptions: @@ -839,7 +842,7 @@ Get plugin stats:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.008647, + "status": 0.008346, "timeout": 3}] Fields descriptions: @@ -867,7 +870,7 @@ Get a specific item when field matches the given value:: "port": 0, "refresh": 30, "rtt_warning": None, - "status": 0.008647, + "status": 0.008346, "timeout": 3}]} GET processcount @@ -876,7 +879,7 @@ GET processcount Get plugin stats:: # curl http://localhost:61208/api/4/processcount - {"pid_max": 0, "running": 1, "sleeping": 416, "thread": 2213, "total": 568} + {"pid_max": 0, "running": 1, "sleeping": 419, "thread": 2266, "total": 569} Fields descriptions: @@ -889,7 +892,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/4/processcount/total - {"total": 568} + {"total": 569} GET processlist --------------- @@ -921,79 +924,79 @@ Get plugin stats:: "--disable-features=CalculateNativeWinOcclusion,FontationsLinuxSystemFonts,ScreenAIOCREnabled,SpareRendererForSitePerProcess", "--variations-seed-version"], "cpu_percent": 0.0, - "cpu_times": {"children_system": 158.53, - "children_user": 218.33, + "cpu_times": {"children_system": 435.99, + "children_user": 453.35, "iowait": 0.0, - "system": 191.03, - "user": 907.54}, + "system": 552.89, + "user": 4699.54}, "gids": {"effective": 1000, "real": 1000, "saved": 1000}, - "io_counters": [878424064, - 340512768, + "io_counters": [1491209216, + 1474269184, 0, 0, 0, - 56623104, - 1708032, + 133365760, + 2252800, 0, 0, 0, - 24398848, - 131072, + 45949952, + 188416, 0, 0, 0, - 77263872, + 83375104, 0, 0, 0, 0, - 79174656, - 25894912, - 0, - 0, - 0, - 32010240, - 184020992, - 0, - 0, - 0, - 15147008, + 10279936, 0, 0, 0, 0, - 33863680, + 47232000, + 184909824, + 0, + 0, + 0, + 88373248, + 72253440, + 0, + 0, + 0, + 3109888, 0, 0, 0, 0, - 9763840, + 37914624, 0, 0, 0, 0, - 659456, + 15155200, 0, 0, 0, 0, - 2506752, + 937984, 0, 0, 0, 0, - 4743168, + 1264640, 0, 0, 0, 0, - 117760, + 5255168, 0, 0, 0, 0, - 3310592, - 2273280, + 5059584, + 5652480, 0, 0, 0, @@ -1008,17 +1011,17 @@ Get plugin stats:: 0, 0], "key": "pid", - "memory_info": {"data": 3776540672, + "memory_info": {"data": 5951479808, "dirty": 0, "lib": 0, - "rss": 2240647168, - "shared": 131801088, + "rss": 3487383552, + "shared": 101527552, "text": 148733952, - "vms": 1526371254272}, - "memory_percent": 13.643459303666877, + "vms": 1526405382144}, + "memory_percent": 21.23492544810573, "name": "code", "nice": 0, - "num_threads": 62, + "num_threads": 78, "pid": 11415, "status": "S", "time_since_update": 1, @@ -1029,22 +1032,22 @@ Get plugin stats:: "--node-ipc", "--clientProcessId=11415"], "cpu_percent": 0.0, - "cpu_times": {"children_system": 0.59, - "children_user": 2.09, + "cpu_times": {"children_system": 1.5, + "children_user": 2.5, "iowait": 0.0, - "system": 14.71, - "user": 197.14}, + "system": 35.29, + "user": 618.52}, "gids": {"effective": 1000, "real": 1000, "saved": 1000}, - "io_counters": [56623104, 1708032, 0, 0, 0], + "io_counters": [133365760, 2252800, 0, 0, 0], "key": "pid", - "memory_info": {"data": 1654235136, + "memory_info": {"data": 1966149632, "dirty": 0, "lib": 0, - "rss": 872312832, + "rss": 848257024, "shared": 74534912, "text": 148733952, "vms": 1501606567936}, - "memory_percent": 5.31157461711455, + "memory_percent": 5.1650970984083004, "name": "code", "nice": 0, "num_threads": 16, @@ -1079,91 +1082,91 @@ Get plugin stats:: 12155, 11329, 13039, - 11209, - 11413, - 12886, - 11414, 11738, - 11758, + 11413, + 11209, 11363, - 12434, + 11414, + 12886, + 11758, 11959, + 12434, 11282, 11212, 11211], "cmdline": ["code"], "cpu_percent": 0, - "cpu_times": {"children_system": 160.45, - "children_user": 227.28000000000003, - "system": 348.16999999999996, - "user": 2324.9900000000002}, - "io_counters": [878424064, - 340512768, + "cpu_times": {"children_system": 438.82, + "children_user": 462.71000000000004, + "system": 989.6999999999999, + "user": 8934.99}, + "io_counters": [1491209216, + 1474269184, 0, 0, 0, - 56623104, - 1708032, + 133365760, + 2252800, 0, 0, 0, - 24398848, - 131072, + 45949952, + 188416, 0, 0, 0, - 77263872, + 83375104, 0, 0, 0, 0, - 79174656, - 25894912, - 0, - 0, - 0, - 32010240, - 184020992, - 0, - 0, - 0, - 15147008, + 10279936, 0, 0, 0, 0, - 33863680, + 47232000, + 184909824, + 0, + 0, + 0, + 88373248, + 72253440, + 0, + 0, + 0, + 3109888, 0, 0, 0, 0, - 9763840, + 37914624, 0, 0, 0, 0, - 659456, + 15155200, 0, 0, 0, 0, - 2506752, + 937984, 0, 0, 0, 0, - 4743168, + 1264640, 0, 0, 0, 0, - 117760, + 5255168, 0, 0, 0, 0, - 3310592, - 2273280, + 5059584, + 5652480, 0, 0, 0, @@ -1177,41 +1180,41 @@ Get plugin stats:: 0, 0, 0], - "memory_info": {"data": 14218362880, - "rss": 5425569792, - "shared": 1318957056, + "memory_info": {"data": 17078657024, + "rss": 6448443392, + "shared": 1219612672, "text": 2379743232, - "vms": 18145110450176}, - "memory_percent": 33.03667873886174, + "vms": 18145168617472}, + "memory_percent": 39.26502853605534, "name": "code", "nice": 0, "nprocs": 16, - "num_threads": 290, + "num_threads": 306, "pid": "_", "status": "S", "time_since_update": 1, "username": "nicolargo"}, - {"childrens": [13003], - "cmdline": ["cloudcode_cli"], + {"childrens": [6739], + "cmdline": ["firefox"], "cpu_percent": 0, - "cpu_times": {"children_system": 0.0, - "children_user": 0.0, + "cpu_times": {"children_system": 1.31, + "children_user": 0.31, "iowait": 0.0, - "system": 8.32, - "user": 65.07}, - "io_counters": [282247168, 0, 0, 0, 0], - "memory_info": {"data": 1286017024, + "system": 412.34, + "user": 1434.83}, + "io_counters": [1124296704, 2744672256, 0, 0, 0], + "memory_info": {"data": 1229332480, "dirty": 0, "lib": 0, - "rss": 814448640, - "shared": 70860800, - "text": 35688448, - "vms": 2558545920}, - "memory_percent": 4.959235453694972, - "name": "cloudcode_cli", + "rss": 690233344, + "shared": 190992384, + "text": 610304, + "vms": 30283108352}, + "memory_percent": 4.202879718587581, + "name": "firefox", "nice": 0, "nprocs": 1, - "num_threads": 20, + "num_threads": 158, "pid": "_", "status": "S", "time_since_update": 1, @@ -1247,19 +1250,19 @@ GET quicklook Get plugin stats:: # curl http://localhost:61208/api/4/quicklook - {"cpu": 6.0, + {"cpu": 7.2, "cpu_hz": 4475000000.0, - "cpu_hz_current": 678548562.5000001, + "cpu_hz_current": 673676062.4999999, "cpu_log_core": 16, "cpu_name": "13th Gen Intel(R) Core(TM) i7-13620H", "cpu_phys_core": 10, - "load": 6.0, - "mem": 72.0, + "load": 9.7, + "mem": 75.2, "percpu": [{"cpu_number": 0, "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 39.0, + "idle": 40.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -1268,13 +1271,13 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 8.0, - "total": 61.0, + "total": 60.0, "user": 0.0}, {"cpu_number": 1, "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 49.0, + "idle": 48.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -1283,8 +1286,8 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 51.0, - "user": 0.0}, + "total": 52.0, + "user": 2.0}, {"cpu_number": 2, "dpc": None, "guest": 0.0, @@ -1299,7 +1302,7 @@ Get plugin stats:: "steal": 0.0, "system": 0.0, "total": 51.0, - "user": 1.0}, + "user": 0.0}, {"cpu_number": 3, "dpc": None, "guest": 0.0, @@ -1319,7 +1322,7 @@ Get plugin stats:: "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 49.0, + "idle": 28.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -1327,14 +1330,14 @@ Get plugin stats:: "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 0.0, - "total": 51.0, - "user": 0.0}, + "system": 10.0, + "total": 72.0, + "user": 11.0}, {"cpu_number": 5, "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 49.0, + "idle": 48.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -1342,29 +1345,29 @@ Get plugin stats:: "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 0.0, - "total": 51.0, - "user": 0.0}, + "system": 1.0, + "total": 52.0, + "user": 2.0}, {"cpu_number": 6, "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 46.0, + "idle": 36.0, "interrupt": None, - "iowait": 0.0, + "iowait": 2.0, "irq": 0.0, "key": "cpu_number", "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 2.0, - "total": 54.0, - "user": 1.0}, + "system": 9.0, + "total": 64.0, + "user": 2.0}, {"cpu_number": 7, "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 19.0, + "idle": 47.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -1372,14 +1375,14 @@ Get plugin stats:: "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 18.0, - "total": 81.0, - "user": 11.0}, + "system": 3.0, + "total": 53.0, + "user": 1.0}, {"cpu_number": 8, "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 46.0, + "idle": 48.0, "interrupt": None, "iowait": 1.0, "irq": 0.0, @@ -1387,14 +1390,14 @@ Get plugin stats:: "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 2.0, - "total": 54.0, - "user": 1.0}, + "system": 1.0, + "total": 52.0, + "user": 0.0}, {"cpu_number": 9, "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 49.0, + "idle": 50.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -1403,7 +1406,7 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 51.0, + "total": 50.0, "user": 0.0}, {"cpu_number": 10, "dpc": None, @@ -1417,7 +1420,7 @@ Get plugin stats:: "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 1.0, + "system": 0.0, "total": 51.0, "user": 0.0}, {"cpu_number": 11, @@ -1439,7 +1442,7 @@ Get plugin stats:: "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 50.0, + "idle": 48.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -1447,8 +1450,8 @@ Get plugin stats:: "nice": 0.0, "softirq": 0.0, "steal": 0.0, - "system": 0.0, - "total": 50.0, + "system": 1.0, + "total": 52.0, "user": 0.0}, {"cpu_number": 13, "dpc": None, @@ -1464,7 +1467,7 @@ Get plugin stats:: "steal": 0.0, "system": 0.0, "total": 51.0, - "user": 0.0}, + "user": 1.0}, {"cpu_number": 14, "dpc": None, "guest": 0.0, @@ -1479,12 +1482,12 @@ Get plugin stats:: "steal": 0.0, "system": 0.0, "total": 51.0, - "user": 0.0}, + "user": 1.0}, {"cpu_number": 15, "dpc": None, "guest": 0.0, "guest_nice": 0.0, - "idle": 49.0, + "idle": 50.0, "interrupt": None, "iowait": 0.0, "irq": 0.0, @@ -1493,9 +1496,9 @@ Get plugin stats:: "softirq": 0.0, "steal": 0.0, "system": 0.0, - "total": 51.0, - "user": 1.0}], - "swap": 1.2} + "total": 50.0, + "user": 0.0}], + "swap": 70.8} Fields descriptions: @@ -1533,14 +1536,14 @@ Get plugin stats:: "label": "Ambient", "type": "temperature_core", "unit": "C", - "value": 33, + "value": 36, "warning": 0}, {"critical": None, "key": "label", "label": "Ambient 3", "type": "temperature_core", "unit": "C", - "value": 28, + "value": 29, "warning": 0}] Fields descriptions: @@ -1604,7 +1607,7 @@ Get a specific item when field matches the given value:: "label": "Ambient", "type": "temperature_core", "unit": "C", - "value": 33, + "value": 36, "warning": 0}]} GET smart @@ -1648,7 +1651,7 @@ GET uptime Get plugin stats:: # curl http://localhost:61208/api/4/uptime - "3 days, 11:17:59" + "3 days, 21:31:00" GET version ----------- @@ -1693,8 +1696,8 @@ Get plugin stats:: # curl http://localhost:61208/api/4/wifi [{"key": "ssid", - "quality_level": -59.0, - "quality_link": 51.0, + "quality_level": -61.0, + "quality_link": 49.0, "ssid": "wlp0s20f3"}] Get a specific field:: @@ -1706,8 +1709,8 @@ Get a specific item when field matches the given value:: # curl http://localhost:61208/api/4/wifi/ssid/value/wlp0s20f3 {"wlp0s20f3": [{"key": "ssid", - "quality_level": -59.0, - "quality_link": 51.0, + "quality_level": -61.0, + "quality_link": 49.0, "ssid": "wlp0s20f3"}]} GET all stats @@ -1771,34 +1774,34 @@ GET stats history History of a plugin:: # curl http://localhost:61208/api/4/cpu/history - {"system": [["2025-11-08T08:09:30.708105+00:00", 3.1], - ["2025-11-08T08:09:31.813979+00:00", 0.9], - ["2025-11-08T08:09:32.864548+00:00", 0.9]], - "user": [["2025-11-08T08:09:30.708102+00:00", 3.6], - ["2025-11-08T08:09:31.813976+00:00", 1.1], - ["2025-11-08T08:09:32.864545+00:00", 1.1]]} + {"system": [["2025-11-08T18:22:33.164399+00:00", 3.1], + ["2025-11-08T18:22:34.272968+00:00", 1.2], + ["2025-11-08T18:22:35.321581+00:00", 1.2]], + "user": [["2025-11-08T18:22:33.164397+00:00", 4.4], + ["2025-11-08T18:22:34.272965+00:00", 1.3], + ["2025-11-08T18:22:35.321577+00:00", 1.3]]} Limit history to last 2 values:: # curl http://localhost:61208/api/4/cpu/history/2 - {"system": [["2025-11-08T08:09:31.813979+00:00", 0.9], - ["2025-11-08T08:09:32.864548+00:00", 0.9]], - "user": [["2025-11-08T08:09:31.813976+00:00", 1.1], - ["2025-11-08T08:09:32.864545+00:00", 1.1]]} + {"system": [["2025-11-08T18:22:34.272968+00:00", 1.2], + ["2025-11-08T18:22:35.321581+00:00", 1.2]], + "user": [["2025-11-08T18:22:34.272965+00:00", 1.3], + ["2025-11-08T18:22:35.321577+00:00", 1.3]]} History for a specific field:: # curl http://localhost:61208/api/4/cpu/system/history - {"system": [["2025-11-08T08:09:29.466300+00:00", 3.1], - ["2025-11-08T08:09:30.708105+00:00", 3.1], - ["2025-11-08T08:09:31.813979+00:00", 0.9], - ["2025-11-08T08:09:32.864548+00:00", 0.9]]} + {"system": [["2025-11-08T18:22:31.921634+00:00", 3.1], + ["2025-11-08T18:22:33.164399+00:00", 3.1], + ["2025-11-08T18:22:34.272968+00:00", 1.2], + ["2025-11-08T18:22:35.321581+00:00", 1.2]]} Limit history for a specific field to last 2 values:: # curl http://localhost:61208/api/4/cpu/system/history - {"system": [["2025-11-08T08:09:31.813979+00:00", 0.9], - ["2025-11-08T08:09:32.864548+00:00", 0.9]]} + {"system": [["2025-11-08T18:22:34.272968+00:00", 1.2], + ["2025-11-08T18:22:35.321581+00:00", 1.2]]} GET limits (used for thresholds) -------------------------------- diff --git a/glances/events_list.py b/glances/events_list.py index 8e2e4fae..d423e544 100644 --- a/glances/events_list.py +++ b/glances/events_list.py @@ -271,6 +271,7 @@ class GlancesEventsList: event_time, event_index, event_state, event_type, event_value, proc_list, proc_desc, global_message ) + # logger.info(self.events_list) return self.len() def _create_event(self, event_time, event_state, event_type, event_value, proc_desc, global_message): diff --git a/glances/plugins/alert/__init__.py b/glances/plugins/alert/__init__.py index 7fff9e6f..f5f0cd42 100644 --- a/glances/plugins/alert/__init__.py +++ b/glances/plugins/alert/__init__.py @@ -12,8 +12,6 @@ from datetime import datetime from functools import reduce from glances.events_list import glances_events - -# from glances.logger import logger from glances.plugins.plugin.model import GlancesPluginModel # { diff --git a/glances/plugins/containers/__init__.py b/glances/plugins/containers/__init__.py index 622e7903..0ef4df40 100644 --- a/glances/plugins/containers/__init__.py +++ b/glances/plugins/containers/__init__.py @@ -287,7 +287,7 @@ class ContainersPlugin(GlancesPluginModel): # CPU alert if 'cpu' in i and 'total' in i['cpu']: # Looking for specific CPU container threshold in the conf file - alert = self.get_alert(i['cpu']['total'], header=i['name'] + '_cpu', action_key=i['name']) + alert = self.get_alert(i['cpu']['total'], header='cpu', action_key=i['name']) if alert == 'DEFAULT': # Not found ? Get back to default CPU threshold value alert = self.get_alert(i['cpu']['total'], header='cpu') @@ -299,7 +299,7 @@ class ContainersPlugin(GlancesPluginModel): alert = self.get_alert( self.memory_usage_no_cache(i['memory']), maximum=i['memory']['limit'], - header=i['name'] + '_mem', + header='mem', action_key=i['name'], ) if alert == 'DEFAULT': @@ -596,3 +596,5 @@ def sort_docker_stats(stats: list[dict[str, Any]]) -> tuple[str, list[dict[str, return sort_by, stats # Return the main sort key and the sorted stats return sort_by, stats + # Return the main sort key and the sorted stats + return sort_by, stats diff --git a/glances/plugins/diskio/__init__.py b/glances/plugins/diskio/__init__.py index 425ca6ea..d189e0c4 100644 --- a/glances/plugins/diskio/__init__.py +++ b/glances/plugins/diskio/__init__.py @@ -190,15 +190,15 @@ class DiskioPlugin(GlancesPluginModel): # continue # Decorate the bitrate with the configuration file - alert_rx = self.get_alert(i['read_bytes'], header=disk_real_name + '_rx') - alert_tx = self.get_alert(i['write_bytes'], header=disk_real_name + '_tx') + alert_rx = self.get_alert(i['read_bytes'], header='rx', action_key=disk_real_name) + alert_tx = self.get_alert(i['write_bytes'], header='tx', action_key=disk_real_name) self.views[i[self.get_key()]]['read_bytes']['decoration'] = alert_rx self.views[i[self.get_key()]]['write_bytes']['decoration'] = alert_tx # Decorate the latency with the configuration file # Try to get the read/write latency for the current disk - alert_latency_rx = self.get_alert(i['read_latency'], header=disk_real_name + '_rx_latency') - alert_latency_tx = self.get_alert(i['write_latency'], header=disk_real_name + '_tx_latency') + alert_latency_rx = self.get_alert(i['read_latency'], header='rx_latency', action_key=disk_real_name) + alert_latency_tx = self.get_alert(i['write_latency'], header='tx_latency', action_key=disk_real_name) # If the alert is not defined, use the default one if alert_latency_rx == 'DEFAULT': alert_latency_rx = self.get_alert(i['read_latency'], header='rx_latency') diff --git a/glances/plugins/folders/__init__.py b/glances/plugins/folders/__init__.py index aaf44304..f4f0a134 100644 --- a/glances/plugins/folders/__init__.py +++ b/glances/plugins/folders/__init__.py @@ -154,6 +154,6 @@ class FoldersPlugin(GlancesPluginModel): msg = '?{:>8}'.format(self.auto_unit(i['size'])) else: msg = '{:>9}'.format(self.auto_unit(i['size'])) - ret.append(self.curse_add_line(msg, self.get_alert(i, header='folder_' + i['indice']))) + ret.append(self.curse_add_line(msg, self.get_alert(i, header='folder', action_key=i['indice']))) return ret diff --git a/glances/plugins/network/__init__.py b/glances/plugins/network/__init__.py index b9affe9d..7ce5103d 100644 --- a/glances/plugins/network/__init__.py +++ b/glances/plugins/network/__init__.py @@ -219,8 +219,8 @@ class NetworkPlugin(GlancesPluginModel): bps_tx = int(i['bytes_sent_rate_per_sec'] * 8) # Decorate the bitrate with the configuration file thresholds - alert_rx = self.get_alert(bps_rx, header=if_real_name + '_rx') - alert_tx = self.get_alert(bps_tx, header=if_real_name + '_tx') + alert_rx = self.get_alert(bps_rx, header='rx', action_key=if_real_name) + alert_tx = self.get_alert(bps_tx, header='tx', action_key=if_real_name) # If nothing is define in the configuration file... # ... then use the interface speed (not available on all systems) diff --git a/glances/plugins/plugin/model.py b/glances/plugins/plugin/model.py index 7e463b8e..11fc7e33 100644 --- a/glances/plugins/plugin/model.py +++ b/glances/plugins/plugin/model.py @@ -14,6 +14,7 @@ I am your father... import copy import re +from datetime import datetime from glances.actions import GlancesActions from glances.events_list import glances_events @@ -665,10 +666,12 @@ class GlancesPluginModel: """ return self.stats - def get_stat_name(self, header=""): - """Return the stat name with an optional header""" + def get_stat_name(self, header=None, action_key=None): + """Return the stat name with an optional action_key and header""" ret = self.plugin_name - if header != '': + if action_key is not None and action_key != '': + ret += '_' + action_key + if header is not None and header != '': ret += '_' + header return ret @@ -679,7 +682,7 @@ class GlancesPluginModel: maximum=100, highlight_zero=True, is_max=False, - header="", + header=None, action_key=None, log=False, ): @@ -717,7 +720,7 @@ class GlancesPluginModel: return 'DEFAULT' # Build the stat_name - stat_name = self.get_stat_name(header=header).lower() + stat_name = self.get_stat_name(header=header, action_key=action_key).lower() # Manage limits # If is_max is set then default style is set to MAX else default is set to OK @@ -788,17 +791,29 @@ class GlancesPluginModel: # A command line is available for the current alert # 1) Build the {{mustache}} dictionary - if isinstance(self.get_stats_action(), list): + stats_action = copy.deepcopy(self.get_stats_action()) + if isinstance(stats_action, list): # If the stats are stored in a list of dict (fs plugin for example) - # Return the dict for the current header mustache_dict = {} - for item in self.get_stats_action(): + for item in stats_action: + # Add the limit to the mustache dict + item['critical'] = self.get_limit('critical', stat_name=stat_name) + item['warning'] = self.get_limit('warning', stat_name=stat_name) + item['careful'] = self.get_limit('careful', stat_name=stat_name) + # Add the current time (now) + item['time'] = datetime.now().isoformat() if item[self.get_key()] == action_key: mustache_dict = item break else: # Use the stats dict - mustache_dict = self.get_stats_action() + # Add the limit to the mustache dict + stats_action['critical'] = self.get_limit('critical', stat_name=stat_name) + stats_action['warning'] = self.get_limit('warning', stat_name=stat_name) + stats_action['careful'] = self.get_limit('careful', stat_name=stat_name) + # Add the current time (now) + stats_action['time'] = datetime.now().isoformat() + mustache_dict = stats_action # 2) Run the action self.actions.run(stat_name, trigger, command, repeat, mustache_dict=mustache_dict) diff --git a/glances/plugins/sensors/__init__.py b/glances/plugins/sensors/__init__.py index 142864c2..7c38882b 100644 --- a/glances/plugins/sensors/__init__.py +++ b/glances/plugins/sensors/__init__.py @@ -226,8 +226,8 @@ class SensorsPlugin(GlancesPluginModel): # Alert processing if i['type'] == sensors_definition.get('cpu_temp').get('type'): if self.is_limit('critical', stat_name=i['type'] + '_' + i['label']): - # Get thresholds for the specific sensor in the glances.conf file (see #2058) - alert = self.get_alert(current=i['value'], header=i['type'] + '_' + i['label']) + # Get thresholds for the specific sensor in the glances.conf file (see #2058)abel']}") + alert = self.get_alert(current=i['value'], header=i['type'], action_key=i['label']) elif self.is_limit('critical', stat_name=i['type']): # Get thresholds for the sensor type in the glances.conf file (see #3049) alert = self.get_alert(current=i['value'], header=i['type']) diff --git a/tests/test_core.py b/tests/test_core.py index ad98854c..c7321bb3 100755 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -538,6 +538,14 @@ class TestGlances(unittest.TestCase): self.assertEqual(get_plugin_dependencies('quicklook'), ['quicklook', 'fs', 'core', 'load', 'alert']) self.assertEqual(get_plugin_dependencies('vms'), ['vms', 'processcount', 'alert']) + def test_023_get_alert(self): + """Test get_alert function""" + print('INFO: [TEST_023] get_alert') + self.assertEqual(stats.get_plugin('cpu').get_alert(10, minimum=0, maximum=100, header='total'), 'OK_LOG') + self.assertEqual(stats.get_plugin('cpu').get_alert(65, minimum=0, maximum=100, header='total'), 'CAREFUL_LOG') + self.assertEqual(stats.get_plugin('cpu').get_alert(75, minimum=0, maximum=100, header='total'), 'WARNING_LOG') + self.assertEqual(stats.get_plugin('cpu').get_alert(85, minimum=0, maximum=100, header='total'), 'CRITICAL_LOG') + def test_093_auto_unit(self): """Test auto_unit classe""" print('INFO: [TEST_093] Auto unit')