In that case I'm not sure, as I don't use SNS. Could share the email with the JSON included, at least then we can see if it's coming from Alertmanager or SNS.
On Wednesday, March 19, 2025 at 12:44:30 PM UTC João Coelho wrote: > Checked and I'm using email, not email-json. > > A quarta-feira, 19 de março de 2025 à(s) 10:37:37 UTC, George Robinson > escreveu: > >> I'm not that familiar with SNS, but as far as Alertmanager is concerned, >> isn't it just sending a message to the SNS topic with the message in the >> template? The actual email notification format is something that is >> configured in AWS? I'm just looking at their FAQ *What are the different >> delivery formats/transports for receiving notifications? * >> https://aws.amazon.com/sns/faqs/ >> >> Perhaps you are using Email-JSON? If the message from Alertmanager >> contains YAML, I presume that YAML will be embedded in the JSON. >> On Wednesday, March 19, 2025 at 10:27:37 AM UTC João Coelho wrote: >> >>> In my Prometheus configuration file, I have the alertmanager_config >>> section, which includes routes, receivers, and template. However, I'm >>> facing an issue where the notification emails are always "the same", and in >>> JSON format, regardless of the template I use or whether templates are >>> defined. Can you help me with this? Is it possible to receive plain text >>> notifications with SNS? Am I missing something? >>> >>> Here's my Prometheus config: >>> alert_manager_definition = <<-EOT >>> template_files: >>> default_template: | >>> {{ define "sns.default.message" }}"receiver": "{{ .Receiver }}"{{ end }} >>> {{ define "sns.default.subject" }}[{{ .Status | toUpper }}{{ if eq >>> .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]{{ end }} >>> {{ define "__alertmanager" }}AlertManager{{ end }} >>> {{ define "__alertmanagerURL" }}{{ .ExternalURL }}/#/alerts?receiver={{ >>> .Receiver | urlquery }}{{ end }} >>> alertmanager_config: | >>> global: >>> templates: >>> - 'default_template' >>> route: >>> receiver: test-grafana >>> group_wait: 30s >>> group_interval: 5m >>> repeat_interval: 10m >>> group_by: [environment, alertname] >>> routes: >>> - receiver: 'grafana-test' >>> group_wait: 10s >>> matchers: >>> - alert_group="node_exporter" >>> - receiver: 'test-grafana' >>> group_wait: 10s >>> matchers: >>> - alert_group="otelcol" >>> receivers: >>> - name: 'test-grafana' >>> sns_configs: >>> - topic_arn: my-sns-topic >>> sigv4: >>> region: eu-central-1 >>> - name: 'grafana-test' >>> sns_configs: >>> - topic_arn: my-sns-topic >>> sigv4: >>> region: eu-central-1 >>> EOT >>> >>> Also tried somethings like these already: >>> alert_manager_definition = <<-EOT >>> alertmanager_config: | >>> route: >>> receiver: test-grafana >>> group_wait: 30s >>> group_interval: 5m >>> repeat_interval: 10m >>> group_by: [environment, alertname] >>> routes: >>> - receiver: 'grafana-test' >>> group_wait: 10s >>> matchers: >>> - alert_group="node_exporter" >>> - receiver: 'test-grafana' >>> group_wait: 10s >>> matchers: >>> - alert_group="otelcol" >>> receivers: >>> - name: 'test-grafana' >>> sns_configs: >>> - topic_arn: my-sns-topic >>> sigv4: >>> region: eu-central-1 >>> - name: 'grafana-test' >>> sns_configs: >>> - topic_arn: my-sns-topic >>> sigv4: >>> region: eu-central-1 >>> EOT >>> >>> alert_manager_definition = <<-EOT >>> alertmanager_config: | >>> route: >>> receiver: test-grafana >>> group_wait: 30s >>> group_interval: 5m >>> repeat_interval: 10m >>> group_by: [environment, alertname] >>> routes: >>> - receiver: 'grafana-test' >>> group_wait: 10s >>> matchers: >>> - alert_group="custom_exporter" >>> - receiver: 'test-grafana' >>> group_wait: 10s >>> matchers: >>> - alert_group="otelcol" >>> receivers: >>> - name: 'test-grafana' >>> sns_configs: >>> - topic_arn: my-sns-topic >>> message: 'There are {{ len .Alerts.Firing }} firing alerts, and {{ len >>> .Alerts.Resolved }} resolved alerts' >>> sigv4: >>> region: eu-central-1 >>> attributes: >>> test-am: prometheus >>> - name: 'grafana-test' >>> sns_configs: >>> - topic_arn: my-sns-topic >>> sigv4: >>> region: eu-central-1 >>> attributes: >>> test-am: amprometheus >>> EOT >>> >>> For all configs showed above, the email notification was alwyas the >>> same, in Json format. >> >> -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/prometheus-users/6c4c137c-b444-42c4-a272-96c2011394bcn%40googlegroups.com.

