Merge remote-tracking branch 'origin/master' into steven-backport

This commit is contained in:
Nico Schottelius 2017-06-19 10:29:20 +02:00
commit 7e768cc42a
11 changed files with 25 additions and 33 deletions

View file

@ -24,7 +24,7 @@ from-package
BOOLEAN PARAMETERS BOOLEAN PARAMETERS
------------------ ------------------
install-init-script install-init-script
Add an init script and set it to start on boot. Default yes. Add an init script and set it to start on boot.
EXAMPLES EXAMPLES
-------- --------

View file

@ -1 +1 @@
command -v svc command -v svc || true

View file

@ -15,3 +15,4 @@ case $os in
;; ;;
esac esac
__package git

View file

@ -10,6 +10,9 @@ DESCRIPTION
----------- -----------
Install and configure Prometheus Alertmanager (https://prometheus.io/docs/alerting/alertmanager/). Install and configure Prometheus Alertmanager (https://prometheus.io/docs/alerting/alertmanager/).
This type create a daemontools-compatible service directory under /service/prometheus.
Daemontools (or something compatible) must be installed (in particular, the command `svc` must be executable).
REQUIRED PARAMETERS REQUIRED PARAMETERS
------------------- -------------------
@ -27,10 +30,7 @@ storage-path
BOOLEAN PARAMETERS BOOLEAN PARAMETERS
------------------ ------------------
with-daemontools None
Create a daemontools service directory under /service/prometheus. Default: yes.
Note: If you do not use this, Alertmanager will not be launched, and will not reload config on change.
If you use this, daemontools (or something compatible) must be installed.
EXAMPLES EXAMPLES
@ -44,6 +44,7 @@ EXAMPLES
__golang_from_vendor --version 1.8.1 # required for prometheus and many exporters __golang_from_vendor --version 1.8.1 # required for prometheus and many exporters
require="__daemontools __golang_from_vendor" __prometheus_alertmanager \ require="__daemontools __golang_from_vendor" __prometheus_alertmanager \
--with-daemontools \
--config "$__manifest/files/alertmanager.yml" \ --config "$__manifest/files/alertmanager.yml" \
--storage-path /data/alertmanager \ --storage-path /data/alertmanager \
--listen-address "[::]:$ALERTPORT" --listen-address "[::]:$ALERTPORT"

View file

@ -11,12 +11,6 @@ config="$(cat "$__object/parameter/config")"
storage_path="$(cat "$__object/parameter/storage-path")" storage_path="$(cat "$__object/parameter/storage-path")"
listen_address="$(cat "$__object/parameter/listen-address")" listen_address="$(cat "$__object/parameter/listen-address")"
ONCHANGE=""
if [ -f "$__object/parameter/with-daemontools" ]; then
__daemontools_service prometheus --run "setuidgid prometheus $GOBIN/prometheus $REAL_FLAGS"
ONCHANGE="svc -h /service/prometheus"
fi
FLAGS="config.file '$CONF' FLAGS="config.file '$CONF'
storage.path '$storage_path' storage.path '$storage_path'
web.listen-address '$listen_address' web.listen-address '$listen_address'
@ -27,12 +21,12 @@ REAL_FLAGS="$(echo "$FLAGS" | sed -nE 's/^([^#]+).*/ --\1 \\/p')"
__go_get github.com/prometheus/alertmanager/cmd/... __go_get github.com/prometheus/alertmanager/cmd/...
__user prometheus --system __user prometheus --system
__directory "$storage_path" --owner prometheus require="__user/prometheus" __directory "$storage_path" --owner prometheus
__directory "$CONF_DIR" --owner prometheus require="__user/prometheus" __directory "$CONF_DIR" --owner prometheus
__daemontools_service alertmanager --run "setuidgid prometheus $GOBIN/alertmanager $REAL_FLAGS" __daemontools_service alertmanager --run "setuidgid prometheus $GOBIN/alertmanager $REAL_FLAGS"
require="$require __directory/$storage_path" \ require="$require __directory/$storage_path __user/prometheus" \
__config_file $CONF \ __config_file $CONF \
--source $config \ --source $config \
--group prometheus --mode 640 \ --group prometheus --mode 640 \

View file

@ -10,6 +10,9 @@ DESCRIPTION
----------- -----------
Install and configure Prometheus (https://prometheus.io/). Install and configure Prometheus (https://prometheus.io/).
This type creates a daemontools-compatible service directory under /service/prometheus.
Daemontools (or something compatible) must be installed (in particular, the command `svc` must be executable).
REQUIRED PARAMETERS REQUIRED PARAMETERS
------------------- -------------------
@ -35,10 +38,7 @@ target-heap-size
BOOLEAN PARAMETERS BOOLEAN PARAMETERS
------------------ ------------------
with-daemontools None
Create a daemontools service directory under /service/prometheus. Default: yes.
Note: If you do not use this, Prometheus will not be launched, and will not reload config on change.
If you use this, daemontools (or something compatible) must be installed.
EXAMPLES EXAMPLES
@ -53,6 +53,7 @@ EXAMPLES
__golang_from_vendor --version 1.8.1 # required for prometheus and many exporters __golang_from_vendor --version 1.8.1 # required for prometheus and many exporters
require="__daemontools __golang_from_vendor" __prometheus_server \ require="__daemontools __golang_from_vendor" __prometheus_server \
--with-daemontools \
--config "$__manifest/files/prometheus.yml" \ --config "$__manifest/files/prometheus.yml" \
--retention-days 14 \ --retention-days 14 \
--storage-path /data/prometheus \ --storage-path /data/prometheus \

View file

@ -16,11 +16,6 @@ rule_files="$(cat "$__object/parameter/rule-files")"
# explorer in kB => convert; by default we go with 1/2 RAM # explorer in kB => convert; by default we go with 1/2 RAM
[ "$target_heap_size" = "auto" ] && target_heap_size=$(($(cat $__global/explorer/memory)*1024/2)) [ "$target_heap_size" = "auto" ] && target_heap_size=$(($(cat $__global/explorer/memory)*1024/2))
ONCHANGE=""
if [ -f "$__object/parameter/with-daemontools" ]; then
__daemontools_service prometheus --run "setuidgid prometheus $GOBIN/prometheus $REAL_FLAGS"
ONCHANGE="&& svc -h /service/prometheus"
fi
FLAGS="config.file '$CONF' FLAGS="config.file '$CONF'
storage.local.path '$storage_path' storage.local.path '$storage_path'
@ -35,23 +30,23 @@ REAL_FLAGS="$(echo "$FLAGS" | sed -nE 's/^([^#]+).*/ --\1 \\/p')"
__go_get github.com/prometheus/prometheus/cmd/... __go_get github.com/prometheus/prometheus/cmd/...
__user prometheus --system __user prometheus --system
__directory "$storage_path" --owner prometheus require="__user/prometheus" __directory "$storage_path" --owner prometheus
__directory "$CONF_DIR" --owner prometheus require="__user/prometheus" __directory "$CONF_DIR" --owner prometheus
__daemontools_service prometheus --run "setuidgid prometheus $GOBIN/prometheus $REAL_FLAGS"
require="$require __directory/$storage_path __user/prometheus" \
require="$require __directory/$storage_path" \
__config_file $CONF \ __config_file $CONF \
--source $config \ --source $config \
--group prometheus --mode 640 \ --group prometheus --mode 640 \
--onchange "$GOBIN/promtool check-config $CONF $ONCHANGE" --onchange "$GOBIN/promtool check-config $CONF && svc -h /service/prometheus"
for file in $rule_files; do for file in $rule_files; do
dest=$CONF_DIR/$(basename $file) dest=$CONF_DIR/$(basename $file)
require="$require __directory/$CONF_DIR" \ require="$require __directory/$CONF_DIR __user/prometheus" \
__config_file "$dest" \ __config_file "$dest" \
--source "$file" \ --source "$file" \
--owner prometheus \ --owner prometheus \
--onchange "$GOBIN/promtool check-rules '$dest' $ONCHANGE" --onchange "$GOBIN/promtool check-rules '$dest' && svc -h /service/prometheus"
done done

View file

@ -1 +0,0 @@
with-daemontools

View file

@ -1,9 +1,10 @@
Changelog Changelog
--------- ---------
next: 4.4.4: 2017-06-16
* Core: Support -j parallelization for object prepare and object run (Darko Poljak) * Core: Support -j parallelization for object prepare and object run (Darko Poljak)
* Type __install_mkfs: mkfs.vfat does not support -q (Nico Schottelius) * Type __install_mkfs: mkfs.vfat does not support -q (Nico Schottelius)
* Types __go_get, __daemontools*, __prometheus*: Fix missing dependencies, fix arguments(Kamila Součková)
4.4.3: 2017-06-13 4.4.3: 2017-06-13
* Type __golang_from_vendor: Install golang from https://golang.org/dl/ (Kamila Součková) * Type __golang_from_vendor: Install golang from https://golang.org/dl/ (Kamila Součková)