nicolargo / glances

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
http://nicolargo.github.io/glances/
Other
26.31k stars 1.49k forks source link

Unable to connect to Influxdb 2.0 #1776

Closed ROODAY closed 3 years ago

ROODAY commented 3 years ago

Description

I followed the docs for connecting to influx but whenever I try to run glances --export influxdb I get Cannot connect to InfluxDB database 'glances' (401: {"code":"unauthorized","message":"Unauthorized"}). I had similar authentication issues connecting Influxdb to Grafana, and was only able to fix it by using the Flux connection options that used Organization and Bucket instead of username and database. Is there a way to use similar connection options for glances? This is my current conf file:

[influxdb]
host=localhost
port=8086
protocol=http
user=ROODAY
password=**************
db=glances

Versions

Logs

2020-12-22 16:53:04,127 -- INFO -- Start Glances 3.1.5
2020-12-22 16:53:04,127 -- INFO -- CPython 3.8.5 and psutil 5.8.0 detected
2020-12-22 16:53:04,129 -- INFO -- Search glances.conf file in /home/rooday/.config/glances/glances.conf
2020-12-22 16:53:04,129 -- INFO -- Read configuration file '/home/rooday/.config/glances/glances.conf'
2020-12-22 16:53:04,133 -- INFO -- Start GlancesStandalone mode
2020-12-22 16:53:04,434 -- WARNING -- Wifi lib is not compliant with Python 3, Wifi plugin is disabled
2020-12-22 16:53:04,608 -- CRITICAL -- Cannot connect to InfluxDB database 'glances' (401: {"code":"unauthorized","message":"Unauthorized"})
paularmstrong commented 3 years ago

InfluxDB v2 requires using authentication token, organization, and bucket arguments. The influxdb API integration within glances will need an update to be able to use it first.

nicolargo commented 3 years ago

Quick analyse concerning the implementation of the InfluxDB 2 API:

Questions to be taken into account before the development:

nicolargo commented 3 years ago

@paularmstrong Implementation for the new exporter (called influxdb2) done in the develop branch.

Read the doc ==> https://github.com/nicolargo/glances/blob/develop/docs/gw/influxdb.rst#influxdb-v2-from-influxdb-v18xflux-and-influxdb-v2x

Note: you need to install the https://pypi.org/project/influxdb-client/ InfluxDB client.

Tested with InfluxDB 2.0.3.

Please can you test it on your side.