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?
Prometheus triggers these alerts automatically when the expression rules match the events occurring in the Prometheus server. To configure your Alertmanager, you have to create a configuration YAML file, then use Helm to apply the configurations.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With