Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram empty custom message sending when message defined #4118

Open
lorrod opened this issue Nov 12, 2024 · 2 comments
Open

Telegram empty custom message sending when message defined #4118

lorrod opened this issue Nov 12, 2024 · 2 comments

Comments

@lorrod
Copy link

lorrod commented Nov 12, 2024

What did you do?

Be able to define custom message

What did you expect to see?

Message sending without errors

What did you see instead? Under which circumstances?

Received an error:
err="telegram: Bad Request: message text is empty (400)"

Environment

  • System information:

docker setup

  • Alertmanager version:

image: prom/alertmanager:v0.28.0-rc.0

  • Prometheus version:

image: prom/prometheus:v2.51.2

  • Alertmanager configuration file:
global:
  resolve_timeout: 5m

route:
  group_by: ['alertname']
  receiver: 'telegram-notifier'
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 3h

receivers:
  - name: 'telegram-notifier'
    telegram_configs:
      - api_url: https://api.telegram.org
        bot_token: $ALERT_NOTIFICATIONS_BOT_TOKEN
        chat_id: $ALERT_NOTIFICATION_CHAT_ID
        message_thread_id: $ALERT_MESSAGE_THREAD_ID
        message: |
          {{ if gt (len .Alerts.Firing) 0 }}
          🚨 Alerts Firing:
          {{ template "__text_alert_list" .Alerts.Firing }}
          {{ end }}
          {{ if gt (len .Alerts.Resolved) 0 }}
          Alerts Resolved:
          {{ template "__text_alert_list" .Alerts.Resolved }}
          {{ end }}
          {{ end }}
  • Logs:
ts=2024-11-12T22:47:21.383Z caller=notify.go:867 level=warn component=dispatcher receiver=telegram-notifier integration=telegram[0] aggrGroup="{}:{alertname=\"ContainerAbsent\"}" msg="Notify attempt failed, will retry later" attempts=1 err="telegram: Bad Request: message text is empty (400)"
ts=2024-11-12T22:52:20.408Z caller=dispatch.go:361 level=error component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="telegram-notifier/telegram[0]: notify retry canceled after 16 attempts: telegram: Bad Request: message text is empty (400)"
ts=2024-11-12T22:52:20.418Z caller=notify.go:867 level=warn component=dispatcher receiver=telegram-notifier integration=telegram[0] aggrGroup="{}:{alertname=\"ContainerAbsent\"}" msg="Notify attempt failed, will retry later" attempts=1 err="telegram: Bad Request: message text is empty (400)"
@grobinson-grafana
Copy link
Contributor

You have an invalid template in message (there is an extra closing {{ end }} on the last line).

@Sumitsh28
Copy link

Can I work on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants