Alertmanager configurations: SMTP

From wikinotes

First, setup a send-only postfix install on the localhost.

Locations

/var/log/maillog SMTP success/fail shown here
/var/log/messages prometheus logs when sending an alert to alertmanager

Postfix

We'll set up a send-only postfix server locally.
See postfix configurations: sendmail only (simple).

Alertmanager

Alertmanager requires that you use an SMTP relay (smarthost).

NOTE:

A sendmail server without a real relay will very quickly get added to a spammer-denylist.
This may be useful if you host your own local IMAP server.

# /usr/local/etc/alertmanager/alertmanager.yml

global:
  smtp_from: 'alertmanager@example.org'

  # an SMTP relay/smarthost is necessary,
  # but you can direct it back to the local postfix to avoid a real/paid one
  # (NOTE: check your SPAM!)
  smtp_smarthost: '127.0.0.1:25'       # smarthost host/port
  #smtp_auth_username: 'alertmanager'  # smarthost username
  #smtp_auth_password: 'password'      # smarthost password

route:
  receiver: smtp-local

receivers:
  - name: 'smtp-local'
    email_configs:
    - to: 'to@domain.com'
      require_tls: false
      send_resolved: true