The following Vagrantfile demonstrates how one could configure a HA setup of Prometheus and Alertmanager. Two nodes running Docker Compose with mirrored Prometheus and Alertmanager containers (configured in a clustered configuration) helps achieve HA. This project was created to demonstrate the following:
- Not have duplicate alerts trigger when >1 Prometheus instance is registered to the same Alertmanager
- Not have duplicate notifications trigger when >1 Alertmanager instance is registered and all instances are exposed to receiving the same alerts
- Have multiple Alertmanagers configured in a cluster and share settings (like Silences)
- Alerts still trigger when one of the Prometheus instances is stopped/removed
- Notifications still trigger when one of the Alertmanager instances is stopped/removed
- Clone/download project source code
- Run
vagrant up
from project root - Update alert Receiver's (this project has a sample AWS SES setup) by updating
/etc/alertmanager/alertmanager.yml
in both Docker nodes. Access Docker nodes usingvagrant ssh docker-node-1
andvagrant ssh docker-node-2
- Restart Alertmanager Docker container on both Docker nodes (
docker ps
to get list of Docker containers. Copy ID of Alertmanager. Restart usingdocker restart <CONTAINER_ID>
) - Poweroff worker node to trigger alert