Configuring Alertmanager to alert via Slack
Create an Alertmanager configuration file
See the Alertmanager configuration documentation and the Slack configuration section for a detailed overview of how to create a configuration file with a Slack receiver.
See the following example of a basic configuration file that is set up with a Slack receiver.
The configuration file must be named config.yml
.
In this example, the Slack channel is set to #prometheus-alerts
.
You can set this to another existing Slack channel, or create the Slack channel #prometheus-alerts
.
config.yml
Save config.yml
into a Git repository, in a subfolder called slack
.
Assume that the repository is https://github.com/company/alertmanager-configs
.
Create the Slack API URL secret
The service is automatically configured to add the following global default value for slack_api_url
in the configuration file.
Create the secret slackapiurl-secret
for the Slack API URL (Webhook URL) to use for notifications.
When installing the service, you must configure the secrets
section to point to the secret slackapiurl-secret
created.
If the Git repository is private, you will need to configure the credentials to access the Git repository.
Install DC/OS Monitoring service
Install the service using the custom options file (options.json
) created in the above steps:
The Alertmanager configurations defined in the repository will be automatically loaded when the service finishes deploying.
Triggering a reload of Alertmanager configurations
It is possible to trigger a reload of the Alertmanager configurations after the service is installed.
Testing Slack alerts
You can test that Alertmanager is configured correctly by sshing to the node on which Alertmanager is running and manually hitting the Alertmanager endpoint to trigger an alert. Alertmanager should route the alert to the Slack channel you configured it to notify.
Check the #prometheus-alerts
Slack channel (or whatever channel configured to receive alerts) and an alert called TestAlert1
should show up shortly.
Navigating to https://<CLUSTER_URL>/service/dcos-monitoring/alertmanager/#/alerts
should also show the alert.