Add alertmanager render script with optional thread id
This commit is contained in:
@@ -23,6 +23,4 @@ receivers:
|
||||
disable_notifications: false
|
||||
api_url: "https://api.telegram.org"
|
||||
send_resolved: true
|
||||
{{- if .Env.TELEGRAM_THREAD_ID }}
|
||||
message_thread_id: ${TELEGRAM_THREAD_ID}
|
||||
{{- end }}
|
||||
__THREAD_LINE__
|
||||
|
||||
14
monitoring/alertmanager/render.sh
Executable file
14
monitoring/alertmanager/render.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
tmp=/etc/alertmanager/alertmanager.yml
|
||||
|
||||
envsubst < /etc/alertmanager/alertmanager.tmpl.yml > "$tmp"
|
||||
|
||||
if [ -n "$TELEGRAM_THREAD_ID" ]; then
|
||||
sed -i "s#__THREAD_LINE__#message_thread_id: $TELEGRAM_THREAD_ID#" "$tmp"
|
||||
else
|
||||
sed -i "s#__THREAD_LINE__##" "$tmp"
|
||||
fi
|
||||
|
||||
exec /bin/alertmanager --config.file="$tmp" --storage.path=/alertmanager
|
||||
Reference in New Issue
Block a user