Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pages/cockpit/how-to/configure-alerts-for-scw-resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ This page shows you how to configure alerts for Scaleway resources in Grafana us
<Message type="important">
You can configure up to a maximum of 10 alerts for the `Scaleway Metrics` data source.
</Message>

<Message type="tip">
Find out how to send Cockpit's alert notifications to Slack using a webkook URL in our [dedicated documentation](/tutorials/configure-slack-alerting/).
</Message>
4 changes: 2 additions & 2 deletions pages/cockpit/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ meta:
<Grid>

<DefaultCard
title="Using Cockpit with Terraform/OpenTofu"
url="/tutorials/use-cockpit-with-terraform/"
title="Sending Cockpit's alert notifications to Slack using a webkook URL"
url="/tutorials/configure-slack-alerting/"
label="Read more"
/>
<DefaultCard
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions tutorials/configure-slack-alerting/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
meta:
title: Sending Cockpit's alert notifications to Slack using a webkook URL
description: Learn how to send your Cockpit alert notifications to your Slack channels for more efficient monitoring.
content:
h1: Sending Cockpit's alert notifications to Slack using a webkook URL
paragraph: Learn how to send your Cockpit alert notifications to your Slack channels for more efficient monitoring.
categories:
- cockpit
dates:
validation: 2025-02-18
posted: 2025-02-18
---

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**.

<Macro id="requirements" />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- [Created](/cockpit/how-to/create-external-data-sources/) data sources
- [Enabled](/cockpit/how-to/enable-alert-manager/) the alert manager
- [Retrieved](/cockpit/how-to/retrieve-grafana-credentials/) your Grafana credentials
- [Configured](/cockpit/how-to/configure-alerts-for-scw-resources/) alerts for your resources (preconfigured or custom)
- [Created](https://slack.com/help/articles/206845317-Create-a-Slack-workspace) a Slack workspace in which you want to receive the alert notifications

## Creating a Slack app

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**.
2. Click **From scratch**.
3. Enter a name for your app. For the purpose of this documentation, we are naming the app `Scaleway alerts`.
4. Pick the workspace you want to receive alerts in from the drop-down.
5. Click **Create App** to confirm. You app's **Basic information** page displays.
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:
- 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.
7. Click **Save Changes** Once you are done configuring your app.

## Activating incoming Webhooks

1. Click **Incoming Webhooks** under the **Features** section.
2. Click the toggle icon to activate incoming webhooks. The **Webhook URLs for Your Workspace** section displays.
3. Click **Add New Webhook to Workspace**. You are prompted to choose a Slack channel in which your Scaleway alerts app will post.
4. Click the drop-down and select one or all Slack channels.
5. Click **Allow**.
6. 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 manager

1. [Access](/cockpit/how-to/access-grafana-and-managed-dashboards/) your Grafana dashboard.
2. Click the **Toggle menu** icon next to **Home** in the top left corner of your screen.
3. Click **Alerting**, then click **Contact points**.
4. Choose the **Scaleway Alerting** alert manager in the drop-down next to the **Choose Alertmanager** field.
5. Click **+ Add contact point**.
6. Enter a contact point name. For example, `Slack alerts`.
7. Select **Slack** from the **Integration** drop-down.
8. In the **Channel** field, paste the name of the Slack channel or user to send notifications to.
9. Click **Optional Slack settings** and paste your Slack app Webhook URL in the **Webhook URL** field.
10. Click **Save contact point**.

<Message type="important">
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.
</Message>

## Configuring a notification policy

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.

1. [Access](/cockpit/how-to/access-grafana-and-managed-dashboards/) your Grafana dashboard.
2. Click the **Toggle menu** icon next to **Home** in the top left corner of your screen.
3. Click **Alerting**, then click **Notification policies**.
4. Click **+ New nested policy**.
5. In the **Label** field, enter the label `alertname`.
6. In the **Operator** field, select **Equals**.
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`.
8. Optionally, click **+Add matcher** to add more labels.
9. In the **Contact point** field, select the contact point you have configured for Slack.
10. Click **Save policy**. Your nested policy displays. You should now get notified on Slack.

<Lightbox src="scaleway-slack-alerts-firing.webp" alt="Grafana alert for high CPU usage notification on Slack" />

Loading