diff --git a/start-alertmanager.sh b/start-alertmanager.sh index 852af28b4c..e2349b5216 100755 --- a/start-alertmanager.sh +++ b/start-alertmanager.sh @@ -68,6 +68,10 @@ for arg; do unset LIMIT fi done +if [ "$DOCKER_PARAM" != "" ]; then + DOCKER_PARAM_FROM_FILE="1" +fi + while getopts ':hlp:r:D:C:f:A:' option; do case "$option" in h) echo "$usage" @@ -79,9 +83,15 @@ while getopts ':hlp:r:D:C:f:A:' option; do ;; f) ALERT_MANAGER_DIR="$USER_PERMISSIONS -v $(readlink -m $OPTARG):/alertmanager/data:z" ;; - l) DOCKER_PARAM="$DOCKER_PARAM --net=host" + l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then + DOCKER_PARAM="$DOCKER_PARAM --net=host" + fi ;; - D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG" + D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then + DOCKER_PARAM="" + DOCKER_PARAM_FROM_FILE="" + fi + DOCKER_PARAM="$DOCKER_PARAM $OPTARG" ;; C) ALERTMANAGER_COMMANDS="$ALERTMANAGER_COMMANDS $OPTARG" ;; diff --git a/start-all.sh b/start-all.sh index ff375fee32..f59caee1e6 100755 --- a/start-all.sh +++ b/start-all.sh @@ -376,7 +376,9 @@ if [ ! -z $LIMIT ]; then usage exit -1 fi - +if [ "$DOCKER_PARAM" != "" ]; then + DOCKER_PARAM_FROM_FILE="1" +fi while getopts ':hleEd:g:p:v:s:n:a:c:j:b:m:r:R:M:G:D:L:N:C:Q:A:f:P:S:T:k:' option; do case "$option" in h) usage @@ -415,7 +417,9 @@ while getopts ':hleEd:g:p:v:s:n:a:c:j:b:m:r:R:M:G:D:L:N:C:Q:A:f:P:S:T:k:' option ;; n) NODE_TARGET_FILE=$OPTARG ;; - l) DOCKER_PARAM="$DOCKER_PARAM --net=host" + l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then + DOCKER_PARAM="$DOCKER_PARAM --net=host" + fi ;; L) CONSUL_ADDRESS="-L $OPTARG" ;; @@ -429,7 +433,11 @@ while getopts ':hleEd:g:p:v:s:n:a:c:j:b:m:r:R:M:G:D:L:N:C:Q:A:f:P:S:T:k:' option ;; C) ALERTMANAGER_COMMANDS+=("$OPTARG") ;; - D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG" + D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then + DOCKER_PARAM="" + DOCKER_PARAM_FROM_FILE="" + fi + DOCKER_PARAM="$DOCKER_PARAM $OPTARG" ;; b) PROMETHEUS_COMMAND_LINE_OPTIONS_ARRAY+=("$OPTARG") ;; diff --git a/start-grafana.sh b/start-grafana.sh index 5c4006e81b..3a0d9ed0b7 100755 --- a/start-grafana.sh +++ b/start-grafana.sh @@ -100,7 +100,9 @@ for arg; do fi done usage="$(basename "$0") [-h] [-v comma separated versions ] [-g grafana port ] [-G path to external dir] [-n grafana container name ] [-p ip:port address of prometheus ] [-j additional dashboard to load to Grafana, multiple params are supported] [-c grafana environment variable, multiple params are supported] [-x http_proxy_host:port] [-m alert_manager address] [-a admin password] [ -M scylla-manager version ] [-D encapsulate docker param] [-Q Grafana anonymous role (Admin/Editor/Viewer)] [-S start with a system specific dashboard set] [-P ldap_config_file] -- loads the prometheus datasource and the Scylla dashboards into an existing grafana installation" - +if [ "$DOCKER_PARAM" != "" ]; then + DOCKER_PARAM_FROM_FILE="1" +fi while getopts ':hlEg:n:p:v:a:x:c:j:m:G:M:D:A:S:P:L:Q:s:' option; do case "$option" in h) echo "$usage" @@ -126,7 +128,9 @@ while getopts ':hlEg:n:p:v:a:x:c:j:m:G:M:D:A:S:P:L:Q:s:' option; do ;; L) DATA_SOURCES="$DATA_SOURCES -L $OPTARG" ;; - l) DOCKER_PARAM="$DOCKER_PARAM --net=host" + l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then + DOCKER_PARAM="$DOCKER_PARAM --net=host" + fi ;; P) LDAP_FILE="$OPTARG" GRAFANA_ENV_ARRAY+=("GF_AUTH_LDAP_ENABLED=true" "GF_AUTH_LDAP_CONFIG_FILE=/etc/grafana/ldap.toml" "GF_AUTH_LDAP_ALLOW_SIGN_UP=true") @@ -134,7 +138,11 @@ while getopts ':hlEg:n:p:v:a:x:c:j:m:G:M:D:A:S:P:L:Q:s:' option; do GRAFANA_AUTH=true GRAFANA_AUTH_ANONYMOUS=false ;; - D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG" + D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then + DOCKER_PARAM="" + DOCKER_PARAM_FROM_FILE="" + fi + DOCKER_PARAM="$DOCKER_PARAM $OPTARG" ;; Q) ANONYMOUS_ROLE=$OPTARG ;; diff --git a/start-loki.sh b/start-loki.sh index 3da22e2f92..389f4679cb 100755 --- a/start-loki.sh +++ b/start-loki.sh @@ -70,6 +70,10 @@ for arg; do unset LIMIT fi done +if [ "$DOCKER_PARAM" != "" ]; then + DOCKER_PARAM_FROM_FILE="1" +fi + while getopts ':hlp:D:m:A:k:t:T:' option; do case "$option" in h) echo "$usage" @@ -83,9 +87,15 @@ while getopts ':hlp:D:m:A:k:t:T:' option; do ;; r) LOKI_RULE_DIR=`readlink -m $OPTARG` ;; - l) DOCKER_PARAM="$DOCKER_PARAM --net=host" + l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then + DOCKER_PARAM="$DOCKER_PARAM --net=host" + fi ;; - D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG" + D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then + DOCKER_PARAM="" + DOCKER_PARAM_FROM_FILE="" + fi + DOCKER_PARAM="$DOCKER_PARAM $OPTARG" ;; C) LOKI_COMMANDS="$LOKI_COMMANDS $OPTARG" ;; diff --git a/start-thanos-sc.sh b/start-thanos-sc.sh index 0a7b3f464a..05e6d5e40b 100755 --- a/start-thanos-sc.sh +++ b/start-thanos-sc.sh @@ -83,9 +83,15 @@ for arg; do unset LIMIT fi done +if [ "$DOCKER_PARAM" != "" ]; then + DOCKER_PARAM_FROM_FILE="1" +fi + while getopts ':hl:p:a:D:d:A:n:' option; do case "$option" in - l) DOCKER_PARAM="$DOCKER_PARAM --net=host" + l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then + DOCKER_PARAM="$DOCKER_PARAM --net=host" + fi ;; d) DATA_DIR="$OPTARG" ;; @@ -100,7 +106,11 @@ while getopts ':hl:p:a:D:d:A:n:' option; do ;; A) BIND_ADDRESS="$OPTARG:" ;; - D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG" + D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then + DOCKER_PARAM="" + DOCKER_PARAM_FROM_FILE="" + fi + DOCKER_PARAM="$DOCKER_PARAM $OPTARG" ;; :) printf "missing argument for -%s\n" "$OPTARG" >&2 echo "$usage" >&2 diff --git a/start-thanos.sh b/start-thanos.sh index 1a5bf358ca..bdc9481d7a 100755 --- a/start-thanos.sh +++ b/start-thanos.sh @@ -12,7 +12,7 @@ Options: -h print this help and exit -S sidecart address - A side cart address:port multiple side cart can be comma delimited -The script starts Thanos query, it connect to external Thanos side carts and act as a grafana data source +The script starts Thanos query, it connect to external Thanos side carts and act as a grafana data source " echo "$__usage" } @@ -87,12 +87,18 @@ for arg; do done SIDECAR=() -DOCKER_PARAM="" +if [ "$DOCKER_PARAM" != "" ]; then + DOCKER_PARAM_FROM_FILE="1" +else + DOCKER_PARAM="" +fi + while getopts ':hlp:S:D:' option; do case "$option" in - l) DOCKER_PARAM="$DOCKER_PARAM --net=host" + l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then + DOCKER_PARAM="$DOCKER_PARAM --net=host" + fi ;; - h) usage exit ;; @@ -100,7 +106,11 @@ while getopts ':hlp:S:D:' option; do SIDECAR+=(--store=$s) done ;; - D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG" + D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then + DOCKER_PARAM="" + DOCKER_PARAM_FROM_FILE="" + fi + DOCKER_PARAM="$DOCKER_PARAM $OPTARG" ;; :) printf "missing argument for -%s\n" "$OPTARG" >&2 echo "$usage" >&2