Generate Snap for Glances 4.4.1

This commit is contained in:
nicolargo 2025-11-03 15:02:24 +01:00
commit 3646e011cf
14 changed files with 4740 additions and 841 deletions

1
.gitignore vendored
View File

@ -69,3 +69,4 @@ uv.lock
# Test
.coverage
tests-data/issues/*/config/

View File

@ -2,6 +2,14 @@
Glances ChangeLog
==============================================================================
=============
Version 4.4.1
=============
Bug corrected:
* Restful API issue after a while (stats are no more updated) #3333
=============
Version 4.4.0
=============

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,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" "Nov 02, 2025" "4.4.0" "Glances"
.TH "GLANCES" "1" "Nov 03, 2025" "4.4.1" "Glances"
.SH NAME
glances \- An eye on your system
.SH SYNOPSIS

View File

@ -20,7 +20,7 @@ import tracemalloc
# Version should start and end with a numerical char
# See https://packaging.python.org/specifications/core-metadata/#version
# Examples: 1.0.0, 1.0.0rc1, 1.1.0_dev1
__version__ = "4.4.1_dev1"
__version__ = "4.4.2_dev1"
__apiversion__ = '4'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPLv3'
@ -189,3 +189,6 @@ def main():
# Glances can be ran in standalone, client or server mode
start(config=core.get_config(), args=core.get_args())
# End of glances/__init__.py

View File

@ -11,7 +11,6 @@
import os
import socket
import sys
import tempfile
import webbrowser
from typing import Annotated, Any, Union
from urllib.parse import urljoin
@ -47,7 +46,6 @@ try:
except ImportError:
logger.critical('Uvicorn import error. Glances cannot start in web server mode.')
sys.exit(2)
import builtins
import contextlib
import threading
import time
@ -469,13 +467,6 @@ class GlancesRestfulApi:
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
if self.args.debug:
fname = os.path.join(tempfile.gettempdir(), 'glances-debug.json')
try:
with builtins.open(fname) as f:
return f.read()
except OSError:
logger.debug(f"Debug file ({fname}) not found")
# Update the stat
self.__update_stats()

View File

@ -268,7 +268,7 @@ please rename it to "{plugin_path.capitalize()}Plugin"'
# It's a weak cache to avoid updating the same plugin too often
# Note: the function always return None
@weak_lru_cache(maxsize=128, ttl=1)
@weak_lru_cache(ttl=1)
def update_plugin(self, p):
"""Update stats, history and views for the given plugin name p"""
self._plugins[p].update()

View File

@ -2,7 +2,9 @@ name: glances
# Version sementic:
# version+buildXX (00 for beta, 01..99 for stable releases)
# Do not forget to set the source-branch option to master for release (see end of file)
version: '4.4.1+build00'
# build00 => glances source-branch should be set to develop
# buildXX => glances source-branch should be set to master
version: '4.4.1+build01'
summary: Glances an Eye on your system. A top/htop alternative.
description: |
@ -73,6 +75,6 @@ parts:
source: https://github.com/nicolargo/glances.git
# For releases, set to master
# For beta/dev, set to develop
source-branch: develop
source-branch: master
python-requirements:
- docker-requirements.txt

View File

@ -0,0 +1,52 @@
Pre-requisites:
- Docker needs to be installed on your system
- https://gethomepage.dev/installation/docker/
Start Docker:
cd ./tests-data/issues/issue3322-homepage/
sh ./run-homepage.sh
Access to the interface:
firefox http://localhost:3000/
Edit the ./config/widgets.yaml file and add (replace 192.168.1.26 by your local IP @):
- glances:
url: http://192.168.1.26:61208
# username: user # optional if auth enabled in Glances
# password: pass # optional if auth enabled in Glances
version: 4 # required only if running glances v4 or higher, defaults to 3
cpu: true # optional, enabled by default, disable by setting to false
mem: true # optional, enabled by default, disable by setting to false
cputemp: true # disabled by default
uptime: true # disabled by default
disk: / # disabled by default, use mount point of disk(s) in glances. Can also be a list (see below)
diskUnits: bytes # optional, bytes (default) or bbytes. Only applies to disk
expanded: true # show the expanded view
label: MyMachine # optional
And the ./config/services.yaml (replace 192.168.1.26 by your local IP @):
- Glances:
- CPU Usage:
widget:
type: glances
url: http://192.168.1.26:61208
version: 4 # required only if running glances v4 or higher, defaults to 3
metric: cpu
- MEM Usage:
widget:
type: glances
url: http://192.168.1.26:61208
version: 4 # required only if running glances v4 or higher, defaults to 3
metric: memory
- Network Usage:
widget:
type: glances
url: http://192.168.1.26:61208
version: 4 # required only if running glances v4 or higher, defaults to 3
metric: network:wlp0s20f3

View File

@ -0,0 +1,7 @@
docker run --rm \
--name homepage \
-p 3000:3000 \
-e HOMEPAGE_ALLOWED_HOSTS=localhost:3000,0.0.0.0:3000 \
-v ./config:/app/config \
-v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/gethomepage/homepage:latest

View File

@ -0,0 +1,18 @@
Pre-requisites:
- Docker needs to be installed on your system
- https://www.home-assistant.io/installation/linux/#install-home-assistant-container
Start Docker:
cd ./tests-data/issues/issue3333-homeassistant/
sh ./run-homeassistant.sh
Access to the interface:
firefox http://localhost:8123/
And install the Glances plugin.
Parameters / Services / + Add / Glances
Stats will be refreshed every 5 minutes.

View File

@ -0,0 +1,9 @@
docker run -d \
--name homeassistant \
--privileged \
--restart=unless-stopped \
-e TZ=Europe/Paris \
-v ./config:/config \
-v /run/dbus:/run/dbus:ro \
--network=host \
ghcr.io/home-assistant/home-assistant:stable

View File

@ -16,9 +16,25 @@ def test_perf_update(glances_stats):
"""
Test Glances perf.
"""
perf_timer = Timer(6)
test_duration = 12 # seconds
perf_timer = Timer(test_duration)
counter = 0
from_cache = 0
from_update = 0
previous_interrupts_gauge = None
while not perf_timer.finished():
glances_stats.update()
# interrupts_gauge should always increase
interrupts_gauge = glances_stats.get_plugin('cpu').get_raw().get('interrupts_gauge')
if interrupts_gauge is not None:
if interrupts_gauge == previous_interrupts_gauge:
from_cache += 1
else:
from_update += 1
previous_interrupts_gauge = interrupts_gauge
counter += 1
assert counter > 6
print(f"{counter} iterations. From cache: {from_cache} | From update: {from_update}")
assert counter > test_duration
assert from_update < from_cache
assert from_cache >= test_duration * 10
assert from_update >= (test_duration / 2) - 1