summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2023-05-18 17:08:39 +0200
committernicolargo <nicolas@nicolargo.com>2023-05-18 17:29:24 +0200
commit2c5df09983b88c9c1b128a23752f85194f26e0e7 (patch)
treed2bff895762695f6753c526e8105f153b9650a28
parentcb9dba3c185d6f28d84044f412d2f0ce52ecd012 (diff)
Influxdb2 export not working #2407
-rw-r--r--docs/gw/influxdb.rst3
-rw-r--r--glances/exports/glances_influxdb2.py9
2 files changed, 8 insertions, 4 deletions
diff --git a/docs/gw/influxdb.rst b/docs/gw/influxdb.rst
index 4c0cc4db..0f0e5de3 100644
--- a/docs/gw/influxdb.rst
+++ b/docs/gw/influxdb.rst
@@ -96,6 +96,9 @@ following:
org=nicolargo
bucket=glances
token=EjFUTWe8U-MIseEAkaVIgVnej_TrnbdvEcRkaB1imstW7gapSqy6_6-8XD-yd51V0zUUpDy-kAdVD1purDLuxA==
+ # Set the interval between two exports (in seconds)
+ # If the interval is set to 0, the Glances refresh time is used (default behavor)
+ #interval=0
# Prefix will be added for all measurement name
# Ex: prefix=foo
# => foo.cpu
diff --git a/glances/exports/glances_influxdb2.py b/glances/exports/glances_influxdb2.py
index 154fea1d..282dcbcd 100644
--- a/glances/exports/glances_influxdb2.py
+++ b/glances/exports/glances_influxdb2.py
@@ -35,7 +35,7 @@ class Export(GlancesExport):
self.prefix = None
self.tags = None
self.hostname = None
- self.interval = 0
+ self.interval = None
# Load the InfluxDB configuration file
self.export_enable = self.load_conf(
@@ -44,14 +44,15 @@ class Export(GlancesExport):
options=['protocol', 'prefix', 'tags', 'interval'],
)
if not self.export_enable:
- exit('Missing INFLUXDB version 1 config')
+ exit('Missing influxdb2 config')
# Interval between two exports (in seconds)
- # if export_interval is set to 0, the Glances refresh time is used (default behavor)
+ if self.interval is None:
+ self.interval = 0
try:
self.interval = int(self.interval)
except ValueError:
- logger.warning("InfluxDB export interval is not an integer, use default value (0)")
+ logger.warning("InfluxDB export interval is not an integer, use default value")
self.interval = 0
# and should be set to the Glances refresh time if the value is 0
self.interval = self.interval if self.interval > 0 else self.args.time