Skip to content

Commit 890682a

Browse files
nerda-codesLaure-di
authored andcommitted
docs(cpt): tutorial to configure slack alerting (scaleway#4401)
1 parent 3061267 commit 890682a

File tree

4 files changed

+91
-2
lines changed

4 files changed

+91
-2
lines changed

pages/cockpit/how-to/configure-alerts-for-scw-resources.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ This page shows you how to configure alerts for Scaleway resources in Grafana us
5050
<Message type="important">
5151
You can configure up to a maximum of 10 alerts for the `Scaleway Metrics` data source.
5252
</Message>
53+
54+
<Message type="tip">
55+
Find out how to send Cockpit's alert notifications to Slack using a webkook URL in our [dedicated documentation](/tutorials/configure-slack-alerting/).
56+
</Message>

pages/cockpit/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ meta:
5252
<Grid>
5353

5454
<DefaultCard
55-
title="Using Cockpit with Terraform/OpenTofu"
56-
url="/tutorials/use-cockpit-with-terraform/"
55+
title="Sending Cockpit's alert notifications to Slack using a webkook URL"
56+
url="/tutorials/configure-slack-alerting/"
5757
label="Read more"
5858
/>
5959
<DefaultCard
29.6 KB
Loading
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
meta:
3+
title: Sending Cockpit's alert notifications to Slack using a webkook URL
4+
description: Learn how to send your Cockpit alert notifications to your Slack channels for more efficient monitoring.
5+
content:
6+
h1: Sending Cockpit's alert notifications to Slack using a webkook URL
7+
paragraph: Learn how to send your Cockpit alert notifications to your Slack channels for more efficient monitoring.
8+
categories:
9+
- cockpit
10+
dates:
11+
validation: 2025-02-18
12+
posted: 2025-02-18
13+
---
14+
15+
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.
16+
17+
As **we do not support Grafana managed alerts**, this documentation only shows you how to **send Cockpit alerts to your Slack channel**.
18+
19+
<Macro id="requirements" />
20+
21+
- A Scaleway account logged into the [console](https://console.scaleway.com)
22+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
23+
- [Created](/cockpit/how-to/create-external-data-sources/) data sources
24+
- [Enabled](/cockpit/how-to/enable-alert-manager/) the alert manager
25+
- [Retrieved](/cockpit/how-to/retrieve-grafana-credentials/) your Grafana credentials
26+
- [Configured](/cockpit/how-to/configure-alerts-for-scw-resources/) alerts for your resources (preconfigured or custom)
27+
- [Created](https://slack.com/help/articles/206845317-Create-a-Slack-workspace) a Slack workspace in which you want to receive the alert notifications
28+
29+
## Creating a Slack app
30+
31+
1. Refer to the [Slack documentation](https://api.slack.com/messaging/webhooks#create-app) 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**.
32+
2. Click **From scratch**.
33+
3. Enter a name for your app. For the purpose of this documentation, we are naming the app `Scaleway alerts`.
34+
4. Pick the workspace you want to receive alerts in from the drop-down.
35+
5. Click **Create App** to confirm. You app's **Basic information** page displays.
36+
6. 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]((https://api.slack.com/slack-marketplace/guidelines)). For example, you can:
37+
- Add a short description in the **Short description** field
38+
- Add an icon
39+
- Choose a background color
40+
- Add a long description that will show up on your app detail page.
41+
7. Click **Save Changes** Once you are done configuring your app.
42+
43+
## Activating incoming Webhooks
44+
45+
1. Click **Incoming Webhooks** under the **Features** section.
46+
2. Click the toggle icon to activate incoming webhooks. The **Webhook URLs for Your Workspace** section displays.
47+
3. Click **Add New Webhook to Workspace**. You are prompted to choose a Slack channel in which your Scaleway alerts app will post.
48+
4. Click the drop-down and select one or all Slack channels.
49+
5. Click **Allow**.
50+
6. Click **Copy** under the **Webhook URL** section, as you will need it in the next steps.
51+
52+
## Creating your Slack integration in Grafana using the Scaleway Alerting alert manager
53+
54+
1. [Access](/cockpit/how-to/access-grafana-and-managed-dashboards/) your Grafana dashboard.
55+
2. Click the **Toggle menu** icon next to **Home** in the top left corner of your screen.
56+
3. Click **Alerting**, then click **Contact points**.
57+
4. Choose the **Scaleway Alerting** alert manager in the drop-down next to the **Choose Alertmanager** field.
58+
5. Click **+ Add contact point**.
59+
6. Enter a contact point name. For example, `Slack alerts`.
60+
7. Select **Slack** from the **Integration** drop-down.
61+
8. In the **Channel** field, paste the name of the Slack channel or user to send notifications to.
62+
9. Click **Optional Slack settings** and paste your Slack app Webhook URL in the **Webhook URL** field.
63+
10. Click **Save contact point**.
64+
65+
<Message type="important">
66+
If you have already created contact points, you need to [configure a nested notification policy](#configuring-a-notification-policy) to define which contact point should receive which alert.
67+
</Message>
68+
69+
## Configuring a notification policy
70+
71+
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.
72+
73+
1. [Access](/cockpit/how-to/access-grafana-and-managed-dashboards/) your Grafana dashboard.
74+
2. Click the **Toggle menu** icon next to **Home** in the top left corner of your screen.
75+
3. Click **Alerting**, then click **Notification policies**.
76+
4. Click **+ New nested policy**.
77+
5. In the **Label** field, enter the label `alertname`.
78+
6. In the **Operator** field, select **Equals**.
79+
7. 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`.
80+
8. Optionally, click **+Add matcher** to add more labels.
81+
9. In the **Contact point** field, select the contact point you have configured for Slack.
82+
10. Click **Save policy**. Your nested policy displays. You should now get notified on Slack.
83+
84+
<Lightbox src="scaleway-slack-alerts-firing.webp" alt="Grafana alert for high CPU usage notification on Slack" />
85+

0 commit comments

Comments
 (0)