From f5c725a57f212f733e0e73d238b64bf49feb5fce Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <49-ahmedbilal@users.noreply.code.ungleich.ch> Date: Tue, 15 Oct 2019 20:19:04 +0200 Subject: [PATCH] Fix issues/Make prometheus+grafana+blackbox types compatible with Debian 10 --- cdist/conf/type/__grafana_dashboard/manifest | 9 ++++++--- cdist/conf/type/__letsencrypt_cert/manifest | 1 + cdist/conf/type/__prometheus_alertmanager/manifest | 3 ++- cdist/conf/type/__prometheus_exporter/manifest | 6 ++++-- cdist/conf/type/__prometheus_server/manifest | 7 ++++--- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cdist/conf/type/__grafana_dashboard/manifest b/cdist/conf/type/__grafana_dashboard/manifest index e652202b..d145c4c3 100755 --- a/cdist/conf/type/__grafana_dashboard/manifest +++ b/cdist/conf/type/__grafana_dashboard/manifest @@ -15,6 +15,10 @@ case $os in # Differntation not needed anymore apt_source_distribution=stable ;; + 10*) + # Differntation not needed anymore + apt_source_distribution=stable + ;; *) echo "Don't know how to install Grafana on $os $os_version. Send us a pull request!" >&2 exit 1 @@ -29,10 +33,9 @@ case $os in --uri https://packages.grafana.com/oss/deb \ --distribution $apt_source_distribution \ --component main - __package apt-transport-https - - require="$require __apt_source/grafana __package/apt-transport-https" __package grafana + require="$require __apt_source/grafana" __apt_update_index + require="$require __package/apt-transport-https __apt_update_index" __package grafana require="$require __package/grafana" __start_on_boot grafana-server require="$require __start_on_boot/grafana-server" __process grafana-server --start "service grafana-server start" ;; diff --git a/cdist/conf/type/__letsencrypt_cert/manifest b/cdist/conf/type/__letsencrypt_cert/manifest index 35962d31..bc039e44 100755 --- a/cdist/conf/type/__letsencrypt_cert/manifest +++ b/cdist/conf/type/__letsencrypt_cert/manifest @@ -39,6 +39,7 @@ if [ -z "${certbot_fullpath}" ]; then 10*) __package_apt certbot ;; + *) echo "Unsupported OS version: $os_version" >&2 exit 1 diff --git a/cdist/conf/type/__prometheus_alertmanager/manifest b/cdist/conf/type/__prometheus_alertmanager/manifest index 8ee818c3..cf410c44 100755 --- a/cdist/conf/type/__prometheus_alertmanager/manifest +++ b/cdist/conf/type/__prometheus_alertmanager/manifest @@ -30,6 +30,7 @@ if [ -f "$__object/parameter/install-from-backports" ]; then *) echo "--install-from-backports is only supported on Devuan -- ignoring." >&2 echo "Send a pull request if you require it." >&2 + exit 1 ;; esac else @@ -60,5 +61,5 @@ require="$require __directory/$storage_path $require_pkg" \ __config_file $CONF \ --source "$config" \ --group prometheus --mode 640 \ - --onchange "service prometheus-alertmanager reload" # TODO when a config-check tool is available, check config here + --onchange "service prometheus-alertmanager restart" # TODO when a config-check tool is available, check config here diff --git a/cdist/conf/type/__prometheus_exporter/manifest b/cdist/conf/type/__prometheus_exporter/manifest index b9e14531..f3930ac6 100644 --- a/cdist/conf/type/__prometheus_exporter/manifest +++ b/cdist/conf/type/__prometheus_exporter/manifest @@ -5,9 +5,11 @@ export GOBIN=/opt/gocode/bin # where to find go binaries exporter="$(cat "$__object/parameter/exporter")" [ -z "$exporter" ] && exporter="$__object_id" -__user prometheus --system +__user prometheus +require="__user/prometheus" __group prometheus +require="__group/prometheus" __user_groups prometheus --group prometheus -require="" +require="__user_groups/prometheus" case $exporter in node) TEXTFILES=/service/node-exporter/textfiles # path for the textfiles collector diff --git a/cdist/conf/type/__prometheus_server/manifest b/cdist/conf/type/__prometheus_server/manifest index 73a0799c..9756169e 100755 --- a/cdist/conf/type/__prometheus_server/manifest +++ b/cdist/conf/type/__prometheus_server/manifest @@ -38,7 +38,8 @@ if [ -f "$__object/parameter/install-from-backports" ]; then esac else __package prometheus - require_pkg="__package/prometheus" + __package prometheus-blackbox-exporter + require_pkg="__package/prometheus __package/prometheus-blackbox-exporter" fi ##### PREPARE PATHS AND SUCH ################################################ @@ -59,7 +60,7 @@ require="$require __directory/$storage_path $require_pkg" \ __config_file $CONF \ --source "$config" \ --group prometheus --mode 640 \ - --onchange "promtool check config $CONF && service prometheus reload" + --onchange "promtool check config $CONF && service prometheus restart" for file in $rule_files; do dest=$CONF_DIR/$(basename "$file") @@ -67,6 +68,6 @@ for file in $rule_files; do __config_file "$dest" \ --source "$file" \ --owner prometheus \ - --onchange "promtool check rules '$dest' && service prometheus reload" + --onchange "promtool check rules '$dest' && service prometheus restart" done