-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,27 +5,40 @@ | |
# ============================================================================== | ||
declare -a options | ||
|
||
if bashio::config.false 'influxdb.enabled'; then | ||
if bashio::config.false 'influxdb.enabled' && bashio::config.false 'influxdb2.enabled'; then | ||
# This script is re-run by systemd whenever it terminates, so sleep for a | ||
# while to avoid a continual loop. | ||
exec sleep 86400 | ||
fi | ||
|
||
options+=(-C /etc/glances.conf) | ||
options+=(--export influxdb) | ||
options+=(--quiet) | ||
function glances_export() { | ||
influxdb_version="$1" | ||
sleep_interval="$2" | ||
|
||
options+=(--time "$(bashio::config 'refresh_time')") | ||
options+=(-C /etc/glances.conf) | ||
options+=(--export "$influxdb_version") | ||
options+=(--quiet) | ||
|
||
if bashio::config.false 'process_info'; then | ||
options+=(--disable-process) | ||
fi | ||
options+=(--time "$(bashio::config 'refresh_time')") | ||
|
||
if bashio::debug; then | ||
options+=(--debug) | ||
fi | ||
if bashio::config.false 'process_info'; then | ||
options+=(--disable-process) | ||
fi | ||
|
||
# Interval | ||
sleep "$(bashio::config 'influxdb.interval')" | ||
if bashio::debug; then | ||
options+=(--debug) | ||
fi | ||
Comment on lines
+24
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are now added twice, when both influxdb1 & 2 are enabled |
||
|
||
# Run Glances | ||
exec glances "${options[@]}" | ||
sleep "$sleep_interval" | ||
glances "${options[@]}" | ||
} | ||
|
||
# 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')" & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not drop things in the background. |
||
fi | ||
if bashio::config.true 'influxdb2.enabled'; then | ||
glances_export "influxdb2" "$(bashio::config 'influxdb2.interval')" & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above. |
||
fi | ||
wait |
There was a problem hiding this comment.
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.