hassio-addons / addon-glances

Glances - Home Assistant Community Add-ons
https://addons.community
MIT License
147 stars 22 forks source link

InfluxDB 2 export crashes glances on start #376

Closed SilentPotat0 closed 11 months ago

SilentPotat0 commented 1 year ago

Problem/Motivation

Glances crashes on boot and cant be used to export data to an influxdb 2 database

Expected behavior

Glances to boot on startup, or if booted manually

Actual behavior

Traceback (most recent call last): File "/usr/bin/glances", line 8, in sys.exit(main()) ^^^^^^ File "/usr/lib/python3.11/site-packages/glances/init.py", line 182, in main core = GlancesMain() ^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/glances/main.py", line 99, in init self.args = self.parse_args() ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/glances/main.py", line 544, in parse_args self.config = Config(args.conf_file) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/glances/config.py", line 121, in init self.read() File "/usr/lib/python3.11/site-packages/glances/config.py", line 158, in read self.parser.read_file(f) File "/usr/lib/python3.11/configparser.py", line 734, in read_file self._read(f, source) File "/usr/lib/python3.11/configparser.py", line 1086, in _read raise DuplicateSectionError(sectname, fpname, configparser.DuplicateSectionError: While reading from '/etc/glances.conf' [line 332]: section 'influxdb2' already exists

Steps to reproduce

Current config:

enabled: true host: REDACTED port: 8086 interval: 15 ssl: false version: 2 username: "" password: "" database: "" prefix: "" token: >- "REDACTED" bucket: REDACTED org: REDACTED

brettmiller commented 1 year ago

I had the same same error and found it appeared to have kept an old glances.conf with an old [influxdb2] section from a prior attempt of setting up glances with influxdb2 before it was supported by the add-on. I removed the glances.conf, reinstalled the add-on and configured it for influxdb2. The add-on now starts but doesn't write an [influxdb2] section to the glances.conf. Trying to manually add an [influxdb2] section to the glances.conf results in the

configparser.DuplicateSectionError:` While reading from '/etc/glances.conf' [line 332]: section 'influxdb2' already exists

error again. Also when saving the influxdb config in the add-on it automatically adds the influxdb v1 options

username: glances
password: ""

back into the config.

github-actions[bot] commented 11 months ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!