Add alertmanager render script with optional thread id

This commit is contained in:
g4st3r
2026-03-07 17:50:19 +00:00
parent 7def3d708e
commit 403f33e2bb
3 changed files with 17 additions and 7 deletions

View File

@@ -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__

View 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