Given 2 servers,
- On both servers, edit the Alertmanager unit file:
sudo vi /etc/systemd/system/alertmanager.service
- In the ExecStart section of the Prometheus Server, add the private IP address of the Alertmanager 2 server using the cluster.peer flag:
ExecStart=/usr/local/bin/alertmanager \
--config.file /etc/alertmanager/alertmanager.yml \
--storage.path /var/lib/alertmanager/ \
--cluster.peer=10.0.1.102:9094
Note: When you add the cluster.peer line, be sure to add the \ at the end of the storage.path line.
-
Save and exit the file by pressing Escape followed by
:x!
. -
SSH to AlertManager 2 server with:
ssh 10.0.1.102
- In the ExecStart section of the Alertmanager 2 server, add the private IP address of the Prometheus Server using the cluster.peer flag:
$ sudo vi /etc/systemd/system/alertmanager.service
ExecStart=/usr/local/bin/alertmanager \
--config.file /etc/alertmanager/alertmanager.yml \
--storage.path /var/lib/alertmanager/ \
--cluster.peer=10.0.1.101:9094
Note: When you add the cluster.peer line, be sure to add the \ at the end of the storage.path line.
-
Save and exit the file by pressing Escape followed by
:x!
. -
On both servers, reload the unit file:
sudo systemctl daemon-reload
- On the Prometheus Server, restart Alertmanager:
sudo systemctl restart alertmanager
- On the Alertmanager 2 server, enable and start Alertmanager:
sudo systemctl enable alertmanager
sudo systemctl start alertmanager
- On both servers, check the status of Alertmanager:
sudo systemctl status alertmanager
-
They should both show a status of active (running).
-
On both servers, press Ctrl+C to exit the process.
-
Access the AlertManager on Prometheus Server instance in a new browser tab:
http://<PROMETHEUS_SERVER_PUBLIC_IP>:9093
-
Click Silences.
-
Click New Silence.
-
Set the following values:
- Name: test
- Value: 1
- Creator: me
- Comment: This is a test
-
Click Create.
-
Access the Alertmanager 2 instance in a new browser tab:
http://<ALERTMANAGER_2_PUBLIC_IP>:9093
-
Click Silences, and verify the silence you created on the Prometheus Server instance appears.
-
Click View, and we should then see it's the one we created.
-
Close out of the Alertmanager 2 terminal, as we will no longer be working in it.
-
On the Prometheus Server, edit the Prometheus configuration file:
sudo vi /etc/prometheus/prometheus.yml
- Add the new Alertmanager (10.0.1.102:9093) to the list of Alertmanager targets:
alerting:
alertmanagers:
- static_configs:
- targets:
- localhost:9093
- 10.0.1.102:9093
-
Save and exit the file by pressing Escape followed by
:x!
. -
Restart Prometheus to reload the config:
sudo systemctl restart prometheus
-
Access the Prometheus server in the browser:
http://<PROMETHEUS_SERVER_PUBLIC_IP>:9090
-
Click Status > Runtime & Build Information.
-
Verify both of your Alertmanagers appear under the Alertmanagers section.