Alertmanager email custom template - char '=3D' replacing #3250
Unanswered
massimogcimino
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys,
I'm tryng to use alertmanager email notification. The emails will be automatically parsed. My issue is that alertmanager emails come out translating the '=' char with a strange characters sequence: '=3D' the result is that the parsers fails.
That was verified by tcpdump betwenn alertmanager and the smarthost:
my template :
`{{ define "custom_mail_subject" }}{{ range .Alerts }}{{ index .Annotations "summary" }}{{ end }}{{ end }}
{{ define "emaildefaulthtml" }}
{{"Service= "}}{{ index .Annotations "summary" }}
{{"Host= "}}{{ index .Labels "instance" }}
{{"Address= "}}0.0.0.0
{{"Date/Time= "}}{{ .StartsAt }}
{{"AlertGroup= "}}POKER_BINGO
{{"Agent= "}}MAIL_CPN
{{"ConsoleType= "}}APP
State= {{ if eq .Status "firing" }}{{ .Labels.severity | toUpper }}{{ else }}OK{{ end }}
{{"Customer= "}}{{ index .Labels "customer" }}
{{"Additional Info= "}}{{ index .Annotations "description" | toUpper }}
{{ end }}
the tcpdump output :
`
Service=3D Host out of disk space (instance xxxxxxxx:9100)
Host=3D xxxxxxxxx
Address=3D 0.0.0.0
Date/Time=3D 2023-02-10 13:15:58.024 +0000 UTC
AlertGroup=3D POKER_BINGO
Agent=3D MAIL_CPN
ConsoleType=3D APP
State=3D CRITICAL
Customer=3D CPN
Additional Info=3D DISK IS ALMOST FULL (< 10% LEFT)\N VALUE =3D 7.20318=
4590749071\N LABELS =3D MAP[CUSTOMER:CPN DEVICE:/DEV/MAPPER/VGVAR-LVVAR FS=
TYPE:XFS HOSTNAME:RP-SASMON01 INSTANCE:RP-SASMON01:9100 JOB:MONITOR MOUNTPO=
INT:/VAR]
=20
--f28846678069f380bf3419c33a60bcd168c7e5edd6b642278fa97a500c1a--
.
K.......[4..3e.....u......
..oJ...QQUIT
`
my alertmanager configuration :
`global:
smtp_smarthost: 'xxxxxxxxx:25'
smtp_from: 'xxxxxxxxxx'
smtp_require_tls: false
route:
group_by: ['...']
group_wait: 30s
group_interval: 5m
repeat_interval: 5m
receiver: 'email_logger'
receivers:
name: 'logger'
webhook_configs:
send_resolved: true
name: 'email'
email_configs:
send_resolved: true
name: 'email_logger'
email_configs:
to: 'xxxxxxxxxxxxxx'
headers:
subject: '{{ template "custom_mail_subject" . }}'
html: '{{ template "emaildefaulthtml" . }}'
send_resolved: true
webhook_configs:
url: 'http://xxxxxxxxx'
send_resolved: true
templates:
'/etc/alertmanager/templates/mail.tmpl'
'/etc/alertmanager/templates/text.tmpl'`
any suggestion to fix?
Beta Was this translation helpful? Give feedback.
All reactions