Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podman support for glances #2374

Merged
merged 27 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0e09840
First version. Container list and CPU ok, need others stats
nicolargo Oct 23, 2022
9f6295a
Merge branch 'develop' into issue1985
nicolargo Jan 13, 2023
216b789
Merge branch 'develop' into issue1985
nicolargo Jan 21, 2023
5dd133a
Add memory info for Podman
nicolargo Jan 21, 2023
b43bf2b
Code should be refactor in order to make it more easy to update if a …
nicolargo Jan 22, 2023
a805386
Add Podman IO, but not workking for the moment because https://github…
nicolargo Jan 22, 2023
532df87
chg: Plugin name - docker -> containers
RazCrimson Feb 14, 2023
b65f800
add: containers Plugin - StatsFetcher
RazCrimson Feb 14, 2023
16c3b43
chg: containers Plugin - switch to docker extension unit
RazCrimson Feb 14, 2023
ebb26e6
chg: containers Plugin - switch to basic podman extension unit
RazCrimson Feb 14, 2023
928752a
fix: containers (Podman) - wrong response format
RazCrimson Feb 14, 2023
7c3fe93
chg: containers Plugin - basic pod support
RazCrimson Feb 18, 2023
95b7b94
chg: containers Plugin - include engine name
RazCrimson Feb 18, 2023
8f8925a
Merge pull request #2269 from RazCrimson/issue1985
nicolargo Feb 19, 2023
89a7383
Merge branch 'develop' into issue1985
nicolargo Feb 19, 2023
2fb510a
Merge branch 'develop' of github.com:nicolargo/glances into issue1985
nicolargo Feb 25, 2023
e56b292
Refactor some deps
nicolargo Feb 25, 2023
806f2a4
Merge branch 'develop' into issue1985
nicolargo Mar 12, 2023
50102c1
Merge branch 'develop' into issue1985
RazCrimson Apr 4, 2023
cd6a9d0
Resolve conflict
nicolargo Apr 30, 2023
7d952b7
Resolve conflict
nicolargo Apr 30, 2023
f7f4f38
chg: containers - tmp fix to make podman work
RazCrimson May 6, 2023
ac1fc64
Merge from develop
nicolargo May 7, 2023
58a97cb
chore: leftover formatting
RazCrimson May 7, 2023
9e52775
chg: containers (Podman) - cache version calls
RazCrimson May 7, 2023
8457d2f
chg: containers - use proper names
RazCrimson May 7, 2023
a29f335
chore: containers - drop unused import
RazCrimson May 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion conf/glances.conf
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ port_default_gateway=True
#web_4_url=https://blog.nicolargo.com/nonexist
#web_4_description=Intranet

[docker]
[containers]
disable=False
# Only show specific containers (comma separated list of container name or regular expression)
# Comment this line to display all containers (default configuration)
Expand All @@ -417,6 +417,8 @@ max_name_size=20
# 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

[amps]
# AMPs configuration are defined in the bottom of this file
Expand Down
37 changes: 37 additions & 0 deletions glances/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import subprocess
import os
from datetime import datetime
import re

from glances.logger import logger

Expand Down Expand Up @@ -366,3 +367,39 @@ def urlopen_auth(url, username, password):
headers={'Authorization': 'Basic ' + base64.b64encode(('%s:%s' % (username, password)).encode()).decode()},
)
)


def string_value_to_float(s):
"""Convert a string with a value and an unit to a float.
Example:
'12.5 MB' -> 12500000.0
'32.5 GB' -> 32500000000.0
Args:
s (string): Input string with value and unit
Output:
float: The value in float
"""
convert_dict = {
None: 1,
'B': 1,
'KB': 1000,
'MB': 1000000,
'GB': 1000000000,
'TB': 1000000000000,
'PB': 1000000000000000,
}
unpack_string = [
i[0] if i[1] == '' else i[1].upper() for i in re.findall(r'([\d.]+)|([^\d.]+)', s.replace(' ', ''))
]
if len(unpack_string) == 2:
value, unit = unpack_string
elif len(unpack_string) == 1:
value = unpack_string[0]
unit = None
else:
return None
try:
value = float(unpack_string[0])
except ValueError:
return None
return value * convert_dict[unit]
6 changes: 3 additions & 3 deletions glances/outputs/glances_curses.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class _GlancesCurses(object):
'c': {'sort_key': 'cpu_percent'},
'C': {'switch': 'disable_cloud'},
'd': {'switch': 'disable_diskio'},
'D': {'switch': 'disable_docker'},
'D': {'switch': 'disable_containers'},
# 'e' > Enable/Disable process extended
# 'E' > Erase the process filter
# 'f' > Show/hide fs / folder stats
Expand Down Expand Up @@ -124,7 +124,7 @@ class _GlancesCurses(object):
_left_sidebar_max_width = 34

# Define right sidebar
_right_sidebar = ['docker', 'processcount', 'amps', 'processlist', 'alert']
_right_sidebar = ['containers', 'processcount', 'amps', 'processlist', 'alert']

def __init__(self, config=None, args=None):
# Init
Expand Down Expand Up @@ -617,7 +617,7 @@ def display(self, stats, cs_status=None):
max_processes_displayed = (
self.term_window.getmaxyx()[0]
- 11
- (0 if 'docker' not in __stat_display else self.get_stats_display_height(__stat_display["docker"]))
- (0 if 'containers' not in __stat_display else self.get_stats_display_height(__stat_display["containers"]))
- (
0
if 'processcount' not in __stat_display
Expand Down
Empty file.
Loading