Using templates in Alertmanager configuration
Defining Alertmanager configuration using static text is not very useful if we're running more than one service. Instead, we should employ templates that will help us customize messages. While we're at it, we can also fix the broken link from the message and customize the title.
Before we proceed, let us remove the monitor_alert-manager
service and the alert_manager_config
secret. That will allow us to deploy it again with better-defined messages.
docker service rm monitor_alert-manager
docker secret rm alert_manager_config
We'll create a new secret with the complete Alertmanager configuration.
echo "route: group_by: [service] receiver: 'slack' repeat_interval: 1h receivers: - name: 'slack' slack_configs: - send_resolved: true title: '[{{ .Status | toUpper }}] {{ .GroupLabels.service }}\ service is in danger!' title_link: 'http://$(docker-machine ip \ swarm-1)/monitor/alerts' text: '{{ .CommonAnnotations...