The configuration file that you posted was mangled - partly by your E-mail 
client I guess, and partly by you (there are two single quotes before 
''my.host')

However, if I use *exactly* the following configuration 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'

then alertmanager starts just fine:

root@prometheus:~# /opt/alertmanager/alertmanager 
--config.file=/tmp/alert.yml
level=info ts=2020-06-06T17:16:00.765Z caller=main.go:231 msg="Starting 
Alertmanager" version="(version=0.20.0, branch=HEAD, 
revision=f74be0400a6243d10bb53812d6fa408ad71ff32d)"
level=info ts=2020-06-06T17:16:00.766Z caller=main.go:232 
build_context="(go=go1.13.5, user=root@00c3106655f8, 
date=20191211-14:13:14)"
level=info ts=2020-06-06T17:16:00.770Z caller=cluster.go:161 
component=cluster msg="setting advertise address explicitly" 
addr=10.12.255.33 port=9094
level=info ts=2020-06-06T17:16:00.777Z caller=cluster.go:623 
component=cluster msg="Waiting for gossip to settle..." interval=2s
level=info ts=2020-06-06T17:16:00.871Z caller=coordinator.go:119 
component=configuration msg="Loading configuration file" file=/tmp/alert.yml
level=info ts=2020-06-06T17:16:00.875Z caller=coordinator.go:131 
component=configuration msg="Completed loading of configuration file" 
file=/tmp/alert.yml
level=info ts=2020-06-06T17:16:00.888Z caller=main.go:497 msg=Listening 
address=:9093
level=info ts=2020-06-06T17:16:02.777Z caller=cluster.go:648 
component=cluster msg="gossip not settled" polls=0 before=0 now=1 
elapsed=2.00028059s
level=info ts=2020-06-06T17:16:10.778Z caller=cluster.go:640 
component=cluster msg="gossip settled; proceeding" elapsed=10.001491515s
q
^C
level=info ts=2020-06-06T17:16:40.881Z caller=main.go:536 msg="Received 
SIGTERM, exiting gracefully..."

root@prometheus:~# /opt/alertmanager/alertmanager --version
alertmanager, version 0.20.0 (branch: HEAD, revision: 
f74be0400a6243d10bb53812d6fa408ad71ff32d)
  build user:       root@00c3106655f8
  build date:       20191211-14:13:14
  go version:       go1.13.5

This is despite the fact that I haven't even created 
/etc/alertmanager/templates/custom-email-template.tmpl

Therefore, I can only surmise that the configuration you're testing with is 
not the one you posted. Maybe you haven't given the correct command-line 
argument to alertmanager to tell it which config file to read, and so it's 
reading a different one than the one you think it is.

-- 
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/9de8ab3d-7f4e-43e1-be5c-665908e776cdo%40googlegroups.com.

Reply via email to