Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for exporting to influxdb v2. #217

Closed
wants to merge 1 commit into from

Conversation

hnefatl
Copy link

@hnefatl hnefatl commented Oct 15, 2021

Proposed Changes

Add configuration options+change influxdb service script to support Glances writing to an InfluxDB 2.x database.

I've tested this using a local addon, and was able to write to both a v1 database (the influxdb HA addon) and a v2 database (an external database running on a different host) at the same time, as well as just writing to one with the other disabled.

Question: I'm not familiar with how existing configurations are handled with addon upgrades: I've added some required fields in this commit, does that mean everyone who upgrades to a version including this commit will need to update their configs to set the required fields to something? Or will HA somehow merge the configs when updating so people won't notice the change? This option set felt best as a separate dictionary, but that means the change isn't really backwards- or forwards- compatible.

Related Issues

@hnefatl
Copy link
Author

hnefatl commented Nov 6, 2021

Bump for review: there's one failing check for a missing PR label, but I don't see a way to apply one to this PR. Assuming I don't have permissions? I'd assume the enhancement or new-feature tags are the most fitting here.

@github-actions
Copy link

github-actions bot commented Dec 7, 2021

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Dec 7, 2021
@hnefatl
Copy link
Author

hnefatl commented Dec 7, 2021

Bump for review again, see note about PR labels above.

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Dec 8, 2021
@frenck frenck added the new-feature New features or options. label Dec 20, 2021
Comment on lines +24 to +30
if bashio::config.false 'process_info'; then
options+=(--disable-process)
fi

# Interval
sleep "$(bashio::config 'influxdb.interval')"
if bashio::debug; then
options+=(--debug)
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are now added twice, when both influxdb1 & 2 are enabled

# Run the export processes in the background, then wait for both to complete
# (otherwise we delay one export by the other's interval).
if bashio::config.true 'influxdb.enabled'; then
glances_export "influxdb" "$(bashio::config 'influxdb.interval')" &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not drop things in the background.

glances_export "influxdb" "$(bashio::config 'influxdb.interval')" &
fi
if bashio::config.true 'influxdb2.enabled'; then
glances_export "influxdb2" "$(bashio::config 'influxdb2.interval')" &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.


options+=(--time "$(bashio::config 'refresh_time')")
options+=(-C /etc/glances.conf)
options+=(--export "$influxdb_version")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If both options are enabled, the influxdb2 process will export both v1 & v2, while v1 is also active.

@github-actions
Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Jan 20, 2022
@github-actions github-actions bot closed this Jan 27, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-feature New features or options. stale There has not been activity on this issue or PR for quite some time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants