InfluxDB > 0.9.3 needs float and not int for numerical value. Correct issue#749 and issue#750

This commit is contained in:
nicolargo 2015-12-12 17:44:30 +01:00
parent 50a7ca7dee
commit 8a7873ed7e

View File

@ -133,9 +133,15 @@ class Export(GlancesExport):
# Manage prefix
if self.prefix is not None:
name = self.prefix + '.' + name
# logger.info(self.prefix)
# Create DB input
if self.version == INFLUXDB_09:
# Convert all int to float (mandatory for InfluxDB>0.9.2)
# Correct issue#750 and issue#749
for i, v in enumerate(points):
try:
points[i] = float(points[i])
except ValueError:
pass
data = [{'measurement': name,
'tags': self.parse_tags(self.tags),
'fields': dict(zip(columns, points))}]