I still haven't figured out why it's not working. Developers responding to
the GitHub issue I opened believe I've got something configured wrong,
since no one else has reported this problem. Can someone confirm that
they're able to use custom templates per the instructions referenced in the
OP? If so, is there something else not mentioned in the instructions that I
need to do?

On Thu, May 28, 2020, 12:38 AM Mark Leone <[email protected]> wrote:

> I'm following this example to define a re-usable template:
> https://prometheus.io/blog/2016/03/03/custom-alertmanager-templates/
>
> and alertmanager is not able to find the template
>
> This is my alertmanager config file:
>
> global:
>     smtp_smarthost: ''my.host:25'
>     smtp_hello: 'my.system'
>     smtp_from: 'my.adderss'
>
> route:
>     receiver: test-email-receiver
>     group_by: [label1, label2]
>
> receivers:
>
>    - name: 'test-email-receiver'
>    email_configs:
>       - to: '[email protected]'
>       text : '{{ template "custom.email" . }}'
>
> templates:
>
>    - '/etc/alertmanager/templates/custom-email-template.tmpl'
>
> This is the contents of /etc/alertmanager/custom-email-template.tmpl:
>
> {{ define "custom.email" }}Test{{ end }}
>
> I'm running the alertmanager:latest docker image, and it fails with the
> error: template "custom.email" not defined
>
> The custom template file is written to the local docker volume by a nomad
> template stanza in the docker driver config, and mapped to
> /etc/alertmanager/templates/custom-email-template.tmpl. I removed the
> text entry in email_configs so I can successfully start the container and
> connect to it with docker exec. I verified that the custom template file is
> where I expect it to be and it has the expected contents. Alertmanager just
> refuses to recognize the template. Either the example is wrong, or I'm
> missing something.
>
> --
> 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 on the web visit
> https://groups.google.com/d/msgid/prometheus-users/f0f16572-6bf7-4085-b9a7-d5948e3b41f3%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/f0f16572-6bf7-4085-b9a7-d5948e3b41f3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAFHj5BddEFUdf_dd-3o9gvi65kN-LcYjEn6Ee0P_YieQ%2BHns7Q%40mail.gmail.com.

Reply via email to