Merge branch 'monitoring-test' into 'master'
Fix issues/Make prometheus+grafana+blackbox types compatible with Debian 10 See merge request ungleich-public/cdist!807
This commit is contained in:
		
				commit
				
					
						1dae7cf9c9
					
				
			
		
					 5 changed files with 17 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -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"
 | 
			
		||||
        ;;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,6 +39,7 @@ if [ -z "${certbot_fullpath}" ]; then
 | 
			
		|||
				10*)
 | 
			
		||||
					__package_apt certbot
 | 
			
		||||
				;;
 | 
			
		||||
 | 
			
		||||
				*)
 | 
			
		||||
					echo "Unsupported OS version: $os_version" >&2
 | 
			
		||||
					exit 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue