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.

Reply via email to