If you have already created contact points, you need to configure a nested notification policy to define which contact point should receive which alert.
Sending Cockpit's alert notifications to Slack using a webkook URL
- cockpit
- alerts
- monitoring
- notifications
- slack
This page shows you how to create a Slack app, a Slack webhook, and your Slack integration using the Scaleway Alerting
alert manager, and how to configure notification policies in Grafana to receive your Cockpit alert notifications in your Slack channel.
As we do not support Grafana managed alerts, this documentation only shows you how to send Cockpit alerts to your Slack channel.
Before you startLink to this anchor
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- Created data sources
- Enabled the alert manager
- Retrieved your Grafana credentials
- Configured alerts for your resources (preconfigured or custom)
- Created a Slack workspace in which you want to receive the alert notifications
Creating a Slack appLink to this anchor
- Refer to the Slack documentation and click Create your Slack app. You are redirected to a new page and a pop-up appears prompting you to either create your app from a manifest or from scratch.
- Click From scratch.
- Enter a name for your app. For the purpose of this documentation, we are naming the app
Scaleway alerts
. - Pick the workspace you want to receive alerts in from the drop-down.
- Click Create App to confirm. You app’s Basic information page displays.
- Optionally, scroll down to Display information to customize the way your app will display in Slack. For more information, refer to the App Detail Guidelines. For example, you can:
- Add a short description in the Short description field
- Add an icon
- Choose a background color
- Add a long description that will show up on your app detail page.
- Click Save Changes Once you are done configuring your app.
Activating incoming WebhooksLink to this anchor
- Click Incoming Webhooks under the Features section.
- Click the toggle icon to activate incoming webhooks. The Webhook URLs for Your Workspace section displays.
- Click Add New Webhook to Workspace. You are prompted to choose a Slack channel in which your Scaleway alerts app will post.
- Click the drop-down and select one or all Slack channels.
- Click Allow.
- Click Copy under the Webhook URL section, as you will need it in the next steps.
Creating your Slack integration in Grafana using the Scaleway Alerting alert managerLink to this anchor
-
Access your Grafana dashboard.
-
Click the Toggle menu icon next to Home in the top left corner of your screen.
-
Click Alerting, then click Contact points.
-
Choose the Scaleway Alerting alert manager in the drop-down next to the Choose Alertmanager field.
-
Click + Add contact point.
-
Enter a contact point name. For example,
Slack alerts
. -
Select Slack from the Integration drop-down.
-
In the Channel field, paste the name of the Slack channel or user to send notifications to.
-
Click Optional Slack settings and paste your Slack app Webhook URL in the Webhook URL field.
-
Click Save contact point.
Important
Configuring a notification policyLink to this anchor
If you have created multiple contact points in Grafana, the default contact point will receive alerts by default. To make sure your alerts are sent to the desired contact point, you need to define notification policies.
-
Access your Grafana dashboard.
-
Click the Toggle menu icon next to Home in the top left corner of your screen.
-
Click Alerting, then click Notification policies.
-
Click + New nested policy.
-
In the Label field, enter the label
alertname
. -
In the Operator field, select Equals.
-
In the Value field, enter the name of an existing alert you want your contact point to be notified for. For example,
alert-for-high-cpu-usage
. -
Optionally, click +Add matcher to add more labels.
-
In the Contact point field, select the contact point you have configured for Slack.
-
Click Save policy. Your nested policy displays. You should now get notified on Slack.