Skip to content

Commit

Permalink
Add another connector to snap
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Jul 7, 2024
1 parent 6f7a096 commit f603e84
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ run-browser: ## Start Glances in browser mode (RPC)
run-issue: ## Start Glances in issue mode
./venv/bin/python -m glances -C ./conf/glances.conf --issue

run-multipass: ## Install and start Glances in a VM (only available on Ubuntu with multipass already installed)
multipass launch -n glances-on-lts lts
multipass exec glances-on-lts -- sudo snap install glances
multipass exec glances-on-lts -- glances
multipass stop glances-on-lts
multipass delete glances-on-lts

show-version: ## Show Glances version number
./venv/bin/python -m glances -C ./conf/glances.conf -V

Expand Down
10 changes: 6 additions & 4 deletions glances/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ def __serve_once(self):
"""
# Update stats
# Start a counter used to compute the time needed
counter = Counter()
counter_update = Counter()
self.stats.update()
logger.debug(f'Stats updated duration: {counter.get()} seconds')
logger.debug(f'Stats updated duration: {counter_update.get()} seconds')

# Patch for issue1326 to avoid < 0 refresh
adapted_refresh = (self.refresh_time - counter.get()) if (self.refresh_time - counter.get()) > 0 else 0
adapted_refresh = (
(self.refresh_time - counter_update.get()) if (self.refresh_time - counter_update.get()) > 0 else 0
)

# Display stats
# and wait refresh_time - counter
Expand Down Expand Up @@ -179,7 +181,7 @@ def serve_n(self, n=1):
def serve_forever(self):
"""Wrapper to the serve_forever function."""
if self.args.stop_after:
self.serve_n(self.args.stop_after)
self.serve_n(n=self.args.stop_after)
else:
while self.__serve_once():
pass
Expand Down
5 changes: 3 additions & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: glances
version: '4.1.2+build01' # Put the current stable version+buildXX
version: '4.1.2+build02' # Put the current stable version+buildXX

summary: Glances an Eye on your system. A top/htop alternative.
description: |
Expand All @@ -17,7 +17,7 @@ apps:
command: bin/glances
plugs: # https://snapcraft.io/docs/supported-interfaces
- network
- system-observe
- system-observe # This one should give read access to all the system
- mount-observe
- hardware-observe
- log-observe
Expand All @@ -32,6 +32,7 @@ apps:
- power-control
- process-control
- network-setup-observe
- all-home
environment:
LANG: C.UTF-8
LC_ALL: C.UTF-8
Expand Down

0 comments on commit f603e84

Please sign in to comment.