Skip to content


 Zabbix
 Grafana
 Prometheus
 Threejs and TypeScript
 SocketIO and TypeScript
 Blender Topological Earth
 Sweet Home 3D
 Design Patterns Python
 Design Patterns TypeScript
   
 Course Coupon Codes
Three.js and TypeScript
Kindle Edition
$9.99 $14.99 Paperback 
$29.99 $34.99




Design Patterns in TypeScript
Kindle Edition
$9.99 $14.99 Paperback
$19.99 $24.99




Design Patterns in Python
Kindle Edition
$9.99 $14.99 Paperback
$19.99 $24.99




Configure Alert Manager to Send Alerts from Prometheus

Video Lecture

Configure Alert Manager to Send Alerts from Prometheus Configure Alert Manager to Send Alerts from Prometheus Configure Alert Manager to Send Alerts from Prometheus

Description

We now configure the Alert Manager process to send emails when the alerting rules fire and resolve.

Edit Alert Manager Configuration

CD into the folder containing the Alert Manager config file called alertmanager.yml

1
cd /etc/prometheus
Backup the original configuration
1
cp alertmanager.yml alertmanager_orig.yml

Open alertmanager.yml and replace the full contents with this below.

1
sudo nano alertmanager.yml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
route:
  receiver: smtp-local
receivers:
  - name: 'smtp-local'
    email_configs:
    - to: 'to@example.com'
      from: 'from@example.com'
      require_tls: false
      #auth_username: 'alertmanager'
      #auth_password: 'password'
      #auth_secret: 'secret'
      #auth_identity: 'identity'
      smarthost: localhost:25
      send_resolved: true

Check your configuration with the supplied amtool

1
amtool check-config alertmanager.yml

If all is ok, restart the Alert Manager service.

1
2
sudo service alertmanager restart
sudo service alertmanager status

To view an existing alertmanager configuration use

1
amtool config

You can also tail the Prometheus Alertmanager logs using the command

1
journalctl -u prometheus-alertmanager.service -f

In the email alerts, at the bottom, you get a link that points to the source metric that is firing/resolved. This url will not be configured by default. To configure it, we can change the prometheus default parameter --web.external-url I am using an Nginx reverse proxy, where I configured SSL and a domain, so I can set it to the external url to https://prometheus.sbcode.net.

1
sudo nano /etc/default/prometheus

Add --web.external-url to the ARGS= variable. eg,

1
ARGS="--web.external-url=https://example.com"

If you have existing settings in the ARGS parameter, then separate them using a space. eg,

1
ARGS="--web.enable-admin-api --web.external-url=https://example.com"