diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b480e3..5dec14b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Changelog #### Changed * Upgrade to upstream version 7.3.2 +* Migrate NetData configuration from deprecated backend configuration to Exporting Engine configuration ## [7.0.3~ynh1](https://github.com/YunoHost-Apps/grafana_ynh/pull/21) - 2020-06-13 diff --git a/scripts/install b/scripts/install index 87f632b..e8fb2b1 100644 --- a/scripts/install +++ b/scripts/install @@ -100,26 +100,28 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring Grafana and InfluxDB..." --weight=30 # If NetData is installed, configure it to feed InfluxDB -netdata_conf="/opt/netdata/etc/netdata/netdata.conf" +netdata_conf="/opt/netdata/etc/netdata/exporting.conf" if [ -f "$netdata_conf" ] ; then - # If there is already a [backend] section - if [ -n "$(cat $netdata_conf | grep '\[backend\]')" ] ; then - # These regexps replaces patterns inside ini [sections] ([backend] section, here) - # (source: https://stackoverflow.com/a/16987794) - sed -i '/^\[backend\]$/,/^\[/ { - s/# enabled = no/enabled = yes/ - s/# type = graphite/type = opentsdb/ - s/# destination = localhost/destination = localhost:4242/ - s/# update every = 10/update every = 60/ - }' $netdata_conf - else - # Otherwise create the section - echo "[backend] -enabled = yes -type = opentsdb -destination = localhost:4242" | tee -a $netdata_conf + sed -i '/^\[exporting:global\]$/,/^\[/ { + s/enabled = no/enabled = yes/ + s/# update every = 10/update every = 60/ + }' $netdata_conf + if [ -z "$(grep "yunohost" $netdata_conf)" ] ; then + cat >> $netdata_conf <> $netdata_conf < dashboard.json