-
Notifications
You must be signed in to change notification settings - Fork 20
/
startup
executable file
·43 lines (35 loc) · 1.63 KB
/
startup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
set -o errexit -o nounset -o pipefail
STORAGE_PATH=/prometheus
[ -d /mnt/mesos/sandbox/prometheus ] && STORAGE_PATH=/mnt/mesos/sandbox/prometheus
mkdir -p $STORAGE_PATH/server $STORAGE_PATH/alertmanager
rm -f $STORAGE_PATH/server/lock
/bin/mkalertmanagercfg "/etc/prometheus/alertmanager.yml"
if [ -n "${RULES-}" ]; then
echo "Writing ENV set RULES to /etc/prometheus/prometheus.rules"
echo -e "$RULES" > /etc/prometheus/prometheus.rules
fi
if [ -n "${SERVER_CONFIG-}" ]; then
echo "Writing Prometheus config to /etc/prometheus/prometheus.yml"
echo -e "$SERVER_CONFIG" > /etc/prometheus/prometheus.yml
fi
if [ -n "${NODE_EXPORTER_SRV-}" ]; then
/bin/srv2file_sd -srv "$NODE_EXPORTER_SRV" -out "/etc/prometheus/node_exporter.json" -loop -time ${SRV_REFRESH_INTERVAL:-60} &
fi
if [ -n "${CADVISOR_SRV-}" ]; then
/bin/srv2file_sd -srv "$CADVISOR_SRV" -out "/etc/prometheus/cadvisor.json" -loop -time ${SRV_REFRESH_INTERVAL:-60} &
fi
/bin/alertmanager --config.file "/etc/prometheus/alertmanager.yml" \
--storage.path "$STORAGE_PATH/alertmanager" &
/bin/sed -i'' \
-e "s#@ALERTMANAGER_SCHEME@#${ALERTMANAGER_SCHEME:-http}#" \
-e "s#@ALERTMANAGER_URL@#${ALERTMANAGER_URL:-localhost:9093}#" \
/etc/prometheus/prometheus.yml
/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=$STORAGE_PATH/server \
--storage.tsdb.retention="${STORAGE_TSDB_RETENTION:-7d}" \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.console.templates=/etc/prometheus/consoles \
--web.external-url="${EXTERNAL_URI:-http://prometheusserver.marathon.l4lb.thisdcos.directory:9090}" \
"$@"