summaryrefslogtreecommitdiffstats
path: root/glances/exports/glances_influxdb/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'glances/exports/glances_influxdb/__init__.py')
-rw-r--r--glances/exports/glances_influxdb/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/glances/exports/glances_influxdb/__init__.py b/glances/exports/glances_influxdb/__init__.py
index a69bfb81..435038f6 100644
--- a/glances/exports/glances_influxdb/__init__.py
+++ b/glances/exports/glances_influxdb/__init__.py
@@ -18,6 +18,8 @@ from glances.exports.export import GlancesExport
from influxdb import InfluxDBClient
from influxdb.client import InfluxDBClientError
+FIELD_TO_TAG = ['name', 'cmdline']
+
class Export(GlancesExport):
"""This class manages the InfluxDB export module."""
@@ -135,6 +137,13 @@ class Export(GlancesExport):
fields.pop(fields['key'])
# Add the hostname as a tag
tags['hostname'] = self.hostname
+ # Add name as a tag (example for the process list)
+ for k in FIELD_TO_TAG:
+ if k in fields:
+ tags[k] = str(fields[k])
+ # Remove it from the field list (can not be a field and a tag)
+ if k in fields:
+ fields.pop(fields[k])
# Add the measurement to the list
ret.append({'measurement': name, 'tags': tags, 'fields': fields})
return ret