diff --git a/README.md b/README.md index c9bd1d0..8296e58 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ Grafana for YunoHost ----------------------------- -**Important: This package is designed to be fed by the NetData application for monitoring measures, so please make sure the YunoHost NetData package is installed before installing it!** +**Important: This package is designed to be fed by the NetData application for monitoring measures, so please make sure the YunoHost [NetData package](https://github.com/YunoHost-Apps/netdata_ynh/) is installed before installing it!** + +NetData only collects, displays and sets alarms based on data from the last hour; this packages allows to archive every metrics and put up statistics and dashboards on the long term. Note: You can use it without NetData, but you'll have to install a collection application (e.g. collectd) to gather data. @@ -18,7 +20,7 @@ Note: You can use it without NetData, but you'll have to install a collection ap --- # Package description: -* installs InfluxDB as timeseries database +* installs InfluxDB as time series database * if the NetData package is installed, configures NetData to feed InfluxDB every minute * installs Grafana as dashboard server * creates a Grafana Data Source to fetch data from InfluxDB (and hence NetData!) diff --git a/check_process b/check_process index dc7db02..a6ef101 100644 --- a/check_process +++ b/check_process @@ -3,6 +3,7 @@ ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) + admin="john" (USER) is_public=1 (PUBLIC|public=1|private=0) ; Checks pkg_linter=1 diff --git a/manifest.json b/manifest.json index 2799ba0..c03762d 100644 --- a/manifest.json +++ b/manifest.json @@ -42,6 +42,15 @@ "example": "/grafana", "default": "/grafana" }, + { + "name": "admin", + "type": "user", + "ask": { + "en": "Choose an admin user", + "fr": "Choisissez l'administrateur" + }, + "example": "homer" + }, { "name": "is_public", "type": "boolean", diff --git a/scripts/install b/scripts/install index adc3299..5cd67ba 100644 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,7 @@ source ./_common.sh # Retrieve arguments domain=$YNH_APP_ARG_DOMAIN path=$YNH_APP_ARG_PATH +admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC # Source YunoHost helpers @@ -26,6 +27,7 @@ sudo yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die "Path not available: ${domain}${path}" # Save app settings +ynh_app_setting_set "$app" admin "$admin" ynh_app_setting_set "$app" is_public "$is_public" # Install needed dependency for HTTPS apt access @@ -144,10 +146,15 @@ while [ -z "$(sudo netstat -lnput|grep grafana)" ] ; do sleep 5s done +# Change admin name to the specified one +mail=$(ynh_user_get_info "$admin" 'mail') +ynh_mysql_connect_as $dbuser $dbpass $dbname <<< "UPDATE user SET login=\"$admin\", email=\"$mail\" WHERE login=\"admin\";" + # Import default dashboard for NetData hostname=$(hostname) sed -i "s@yunohost.yunohost.org@$hostname@g" ../conf/grafana_init_data.sql -mysql -u $dbuser -p$dbpass $dbname < ../conf/grafana_init_data.sql +ynh_mysql_connect_as $dbuser $dbpass $dbname < ../conf/grafana_init_data.sql + # Restart grafana server to take db change into account sudo systemctl restart grafana-server