Correct issue with long container name (Docker plugin)

This commit is contained in:
Nicolargo 2015-07-12 16:06:25 +02:00
parent 2e5114d318
commit e116ff4d45
2 changed files with 3 additions and 3 deletions

View File

@ -146,6 +146,7 @@ class Export(GlancesExport):
def export(self, name, columns, points): def export(self, name, columns, points):
"""Write the points to the InfluxDB server.""" """Write the points to the InfluxDB server."""
logger.debug("Export {} stats to InfluxDB".format(name))
# Manage prefix # Manage prefix
if self.prefix is not None: if self.prefix is not None:
name = self.prefix + '.' + name name = self.prefix + '.' + name
@ -161,5 +162,4 @@ class Export(GlancesExport):
try: try:
self.client.write_points(data) self.client.write_points(data)
except Exception as e: except Exception as e:
logger.error("Can not export stats to InfluxDB (%s)" % e) logger.error("Can not export {} stats to InfluxDB ({})".format(name, e))
logger.debug("Export {} stats to InfluxDB".format(name))

View File

@ -427,7 +427,7 @@ class Plugin(GlancesPlugin):
# Name # Name
name = container['Names'][0] name = container['Names'][0]
if len(name) > 20: if len(name) > 20:
name = '_' + name[:-19] name = '_' + name[-19:]
else: else:
name = name[:20] name = name[:20]
msg = ' {0:20}'.format(name) msg = ' {0:20}'.format(name)