From bdcee3a8124dc6c6f76ae9f0a409a33d1797464d Mon Sep 17 00:00:00 2001 From: nclsHart Date: Tue, 27 Jan 2015 00:12:20 +0100 Subject: [PATCH 1/4] better rendering for docker plugin --- glances/outputs/static/css/style.css | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/glances/outputs/static/css/style.css b/glances/outputs/static/css/style.css index 3fcd08d5..3ac50123 100644 --- a/glances/outputs/static/css/style.css +++ b/glances/outputs/static/css/style.css @@ -84,11 +84,18 @@ body { padding-left: 20px; } #processlist table tr td { + text-align: right; +} +#processlist table tr td, +#docker table tr td { padding: 0px 5px 0px 5px; white-space: nowrap; - text-align: right; } #processlist table tr td:nth-child(6), #processlist table tr td:nth-child(12) { text-align: left; +} +#docker table tr td:nth-child(2), +#docker table tr td:nth-child(6) { + text-align: left; } \ No newline at end of file From 63b3250ae3b5549c3dd0d04940dddeaddcacb07a Mon Sep 17 00:00:00 2001 From: nicolargo Date: Tue, 27 Jan 2015 13:41:35 +0100 Subject: [PATCH 2/4] Glances 2.3RC2 --- glances/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glances/__init__.py b/glances/__init__.py index 0d29033a..55d49380 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -20,7 +20,7 @@ """Init the Glances software.""" __appname__ = 'glances' -__version__ = '2.3_RC1' +__version__ = '2.3_RC2' __author__ = 'Nicolas Hennion ' __license__ = 'LGPL' diff --git a/setup.py b/setup.py index e46c3484..0b35db6e 100755 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ def get_requires(): setup( name='Glances', - version='2.3RC1', + version='2.3RC2', description="A cross-platform curses-based monitoring tool", long_description=open('README.rst').read(), author='Nicolas Hennion', From 5c529102fd0e938561213ccdf3f898096021897f Mon Sep 17 00:00:00 2001 From: Nicolargo Date: Tue, 27 Jan 2015 13:42:11 +0100 Subject: [PATCH 3/4] Glances 2.3RC2 --- glances/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glances/__init__.py b/glances/__init__.py index 0d29033a..55d49380 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -20,7 +20,7 @@ """Init the Glances software.""" __appname__ = 'glances' -__version__ = '2.3_RC1' +__version__ = '2.3_RC2' __author__ = 'Nicolas Hennion ' __license__ = 'LGPL' diff --git a/setup.py b/setup.py index e46c3484..0b35db6e 100755 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ def get_requires(): setup( name='Glances', - version='2.3RC1', + version='2.3RC2', description="A cross-platform curses-based monitoring tool", long_description=open('README.rst').read(), author='Nicolas Hennion', From 965922cc877673f6d67b70ff44fba6e7fa239de8 Mon Sep 17 00:00:00 2001 From: Nicolargo Date: Tue, 27 Jan 2015 13:57:08 +0100 Subject: [PATCH 4/4] Try/catch for containers CPU and MEM stats --- glances/plugins/glances_docker.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/glances/plugins/glances_docker.py b/glances/plugins/glances_docker.py index b4ce6262..692ac541 100644 --- a/glances/plugins/glances_docker.py +++ b/glances/plugins/glances_docker.py @@ -168,13 +168,17 @@ class Plugin(GlancesPlugin): Output: a dict {'total': 1.49, 'user': 0.65, 'system': 0.84}""" ret = {} # Read the stats - with open('/sys/fs/cgroup/cpuacct/docker/' + id + '/cpuacct.stat', 'r') as f: - for line in f: - m = re.search(r"(system|user)\s+(\d+)", line) - if m: - ret[m.group(1)] = int(m.group(2)) + try: + with open('/sys/fs/cgroup/cpuacct/docker/' + id + '/cpuacct.stat', 'r') as f: + for line in f: + m = re.search(r"(system|user)\s+(\d+)", line) + if m: + ret[m.group(1)] = int(m.group(2)) + except IOError as e: + logger.error("Can not grab container CPU stat ({0})".format(e)) + return ret # Get the user ticks - ticks = self.get_user_ticks() + ticks = self.get_user_ticks() if isinstance(ret["system"], numbers.Number) and isinstance(ret["user"], numbers.Number): ret["total"] = ret["system"] + ret["user"] for k in ret.keys(): @@ -188,11 +192,15 @@ class Plugin(GlancesPlugin): Output: a dict {'rss': 1015808, 'cache': 356352}""" ret = {} # Read the stats - with open('/sys/fs/cgroup/memory/docker/' + id + '/memory.stat', 'r') as f: - for line in f: - m = re.search(r"(rss|cache)\s+(\d+)", line) - if m: - ret[m.group(1)] = int(m.group(2)) + try: + with open('/sys/fs/cgroup/memory/docker/' + id + '/memory.stat', 'r') as f: + for line in f: + m = re.search(r"(rss|cache)\s+(\d+)", line) + if m: + ret[m.group(1)] = int(m.group(2)) + except IOError as e: + logger.error("Can not grab container MEM stat ({0})".format(e)) + return ret # Return the stats return ret