Here is my alertmanager version info:

alertmanager, version 0.20.0 (branch: HEAD, revision: f74be04
<https://github.com/prometheus/alertmanager/commit/f74be0400a6243d10bb53812d6fa408ad71ff32d>
)
build user: root@00c3106655f8
biold date: 20191211-14:13:14
go version: gol.13.5

Please clarify what you mean when you say "Alertmanager should start with
an unknown template. ". I reference a template in the text field of the
email_configs setting. If I reference the default template (either
explicitly or by not specifying the text property), it works. It finds the
template and sends a templated message as expected.If I reference the
custom template that I defined (custom.email), alertmanager fails to start
and says it can't find the template I referenced. AFAICAT I followed the
example exactly in defining a custom template and pointing to it in the
"templates" config setting. I also exec into the docker image and verify
that the custom template file is where I pointed alertmanager to,
permissions are opened, and it contains the text I expect it to contain.I
did see a report somewhere that you can't override the default templates,
so I gave my template a different name; but still alertmanager is not able
to find it.


On Wed, Jun 3, 2020 at 1:20 AM Julien Pivotto <[email protected]>
wrote:

> Which version is this? Alertmanager should start with an unknown template.
>
> Le mer. 3 juin 2020 à 02:35, Mark Leone <[email protected]> a écrit :
>
>> 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
>> <https://groups.google.com/d/msgid/prometheus-users/CAFHj5BddEFUdf_dd-3o9gvi65kN-LcYjEn6Ee0P_YieQ%2BHns7Q%40mail.gmail.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/CAFHj5Bfqp5B_-B4%2BZeBC3t7EvFfZXfyMMpz%3D2jQTxUoWduTMpA%40mail.gmail.com.

Reply via email to