duggulous
duggulous

Reputation: 2727

How do I tell Prometheus' Alertmanager to send email through Gmail's SMTP server

I would like Prometheus to send emails from a Gmail (Gapps) account when metrics cross certain thresholds. In the Alertmanager config docs, there's no mention of passwords. How do I authenticate to the SMTP server?

Upvotes: 5

Views: 21452

Answers (2)

Vishesh Kumar Singh
Vishesh Kumar Singh

Reputation: 303

You can use the following template in your alert manager configuration file and change the values according to your requirement.

config:
  global:
    resolve_timeout: 5m
  route:
    group_by: ['job']
    group_wait: 30s
    group_interval: 5m
    repeat_interval: 1h
    receiver: 'tech-email'
    routes:
    - match:
        alertname: Watchdog
      receiver: 'null'
  receivers:
  - name: 'tech-email'
    email_configs:
    - to: '[email protected]'
      from: '[email protected]'
      auth_username: **********
      auth_password: **********
      require_tls: yes
      smarthost: **********
      send_resolved: true
  - name: 'null'

For auth_username, auth_password and smarthost, you can generate the credentials from SES or any provider.

Upvotes: 1

brian-brazil
brian-brazil

Reputation: 34122

This can be done with the fields auth_username, auth_password and auth_identity in the config file.

There's a full guide at http://www.robustperception.io/sending-email-with-the-alertmanager-via-gmail/

Make sure you're using a very recent alertmanager, 0.1.1 won't work.

Upvotes: 7

Related Questions