Merge branch 'develop' of github.com:nicolargo/glances into develop

This commit is contained in:
Nicolargo 2015-01-30 19:27:18 +01:00
commit 928026c8c1
4 changed files with 29 additions and 14 deletions

View File

@ -20,7 +20,7 @@
"""Init the Glances software.""" """Init the Glances software."""
__appname__ = 'glances' __appname__ = 'glances'
__version__ = '2.3_RC1' __version__ = '2.3_RC2'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>' __author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPL' __license__ = 'LGPL'

View File

@ -84,11 +84,18 @@ body {
padding-left: 20px; padding-left: 20px;
} }
#processlist table tr td { #processlist table tr td {
text-align: right;
}
#processlist table tr td,
#docker table tr td {
padding: 0px 5px 0px 5px; padding: 0px 5px 0px 5px;
white-space: nowrap; white-space: nowrap;
text-align: right;
} }
#processlist table tr td:nth-child(6), #processlist table tr td:nth-child(6),
#processlist table tr td:nth-child(12) { #processlist table tr td:nth-child(12) {
text-align: left; text-align: left;
}
#docker table tr td:nth-child(2),
#docker table tr td:nth-child(6) {
text-align: left;
} }

View File

@ -168,13 +168,17 @@ class Plugin(GlancesPlugin):
Output: a dict {'total': 1.49, 'user': 0.65, 'system': 0.84}""" Output: a dict {'total': 1.49, 'user': 0.65, 'system': 0.84}"""
ret = {} ret = {}
# Read the stats # Read the stats
with open('/sys/fs/cgroup/cpuacct/docker/' + id + '/cpuacct.stat', 'r') as f: try:
for line in f: with open('/sys/fs/cgroup/cpuacct/docker/' + id + '/cpuacct.stat', 'r') as f:
m = re.search(r"(system|user)\s+(\d+)", line) for line in f:
if m: m = re.search(r"(system|user)\s+(\d+)", line)
ret[m.group(1)] = int(m.group(2)) 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 # 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): if isinstance(ret["system"], numbers.Number) and isinstance(ret["user"], numbers.Number):
ret["total"] = ret["system"] + ret["user"] ret["total"] = ret["system"] + ret["user"]
for k in ret.keys(): for k in ret.keys():
@ -188,11 +192,15 @@ class Plugin(GlancesPlugin):
Output: a dict {'rss': 1015808, 'cache': 356352}""" Output: a dict {'rss': 1015808, 'cache': 356352}"""
ret = {} ret = {}
# Read the stats # Read the stats
with open('/sys/fs/cgroup/memory/docker/' + id + '/memory.stat', 'r') as f: try:
for line in f: with open('/sys/fs/cgroup/memory/docker/' + id + '/memory.stat', 'r') as f:
m = re.search(r"(rss|cache)\s+(\d+)", line) for line in f:
if m: m = re.search(r"(rss|cache)\s+(\d+)", line)
ret[m.group(1)] = int(m.group(2)) 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 the stats
return ret return ret

View File

@ -52,7 +52,7 @@ def get_requires():
setup( setup(
name='Glances', name='Glances',
version='2.3RC1', version='2.3RC2',
description="A cross-platform curses-based monitoring tool", description="A cross-platform curses-based monitoring tool",
long_description=open('README.rst').read(), long_description=open('README.rst').read(),
author='Nicolas Hennion', author='Nicolas Hennion',