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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/prometheus-users/c24047e9-1bd1-4371-8eb5-c211dcc3b60cn%40googlegroups.com.

Reply via email to