> For the complete documentation index, see [llms.txt](https://docs.trilio.io/openstack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trilio.io/openstack/admin-guide/grafana-monitoring/configuring-slack-webhook-and-alert-notifications.md).

# Configuring Slack Webhook and Alert Notifications

### Prerequisites

Before creating a Slack Webhook URL, ensure the following requirements are met:

* A **Slack workspace** where you have **admin privileges**.
* Basic understanding of **enterprise messaging platforms**.
* Access to the Slack API portal.
* Create a new private channel to recieve slack webhook notifications

***

## Steps to Set Up Slack Webhook URL

**Incoming Webhooks in Slack** allow third-party applications to send messages directly to a Slack channel when specific events occur.\
Slack provides a simple interface to configure Webhooks for integrations and alert notifications.

Follow the steps below to generate a Slack Webhook URL.

***

### Step 1

Go to the Slack API portal:

```
https://api.slack.com/apps
```

Log in and click **Create an App**.

![](https://1827348953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2ForlTBnmtYCfO7jjPr0BM%2Fuploads%2Fgit-blob-8dcb321341a40d006b035568b66eb7ae68ccfc8b%2Fstep-1.png?alt=media)

***

### Step 2

Select **From Scratch** and give the application a name.

<figure><img src="https://1827348953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2ForlTBnmtYCfO7jjPr0BM%2Fuploads%2Fgit-blob-fec840517cc5882595285a3c5e719cf11cbe8461%2Fstep-2.png?alt=media" alt=""><figcaption></figcaption></figure>

***

### Step 3

Choose the **Slack Workspace** that should be connected to the application.

<figure><img src="https://1827348953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2ForlTBnmtYCfO7jjPr0BM%2Fuploads%2Fgit-blob-cb7546bfab75502293e9c4fd83f3f68711a03020%2Fstep-3.png?alt=media" alt=""><figcaption></figcaption></figure>

\---

### Step 4

On the application configuration page, locate and select **Incoming Webhooks**.

<figure><img src="https://1827348953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2ForlTBnmtYCfO7jjPr0BM%2Fuploads%2Fgit-blob-f2a8a8da0e2a5e0fcf7557a23ca0061adae07c7d%2Fstep-4.png?alt=media" alt=""><figcaption></figcaption></figure>

***

### Step 5

Enable the **Activate Incoming Webhooks** toggle and Click **Add New Webhook to Workspace** to create a webhook configuration.

Scroll to the bottom of the page.

<figure><img src="https://1827348953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2ForlTBnmtYCfO7jjPr0BM%2Fuploads%2Fgit-blob-4a00d0451c8406c0553ba76245558b95795b5e3e%2Fstep-5.png?alt=media" alt=""><figcaption></figcaption></figure>

***

### Step 6

Select the **Slack channel** where messages should be posted.

<figure><img src="https://1827348953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2ForlTBnmtYCfO7jjPr0BM%2Fuploads%2Fgit-blob-ee9e98ae64a9fad02da062f1899cc72bfed3fa2f%2Fstep-6.png?alt=media" alt=""><figcaption></figcaption></figure>

***

### Step 7

After authorization, you will be redirected to the webhook configuration page where the **Webhook URL** will be displayed.

<figure><img src="https://1827348953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2ForlTBnmtYCfO7jjPr0BM%2Fuploads%2Fgit-blob-b4c29c95488963f695f3fceb63dc4c8ed9ebeff6%2Fstep-07.png?alt=media" alt=""><figcaption></figcaption></figure>

***

### Step 8

Copy the above **Webhook URL** and use it in your alerting or notification configuration.

To test the webhook, you can send a request using `curl`:

```bash
curl -X POST -H 'Content-type: application/json' \
--data '{"text":"Hello, World!"}' \
<YOUR_WEBHOOK_URL>
```

If configured correctly, the message will appear in the selected Slack channel.

***

The Slack Webhook setup is now complete.

\ <br>

***

### Slack Alerting

Alerts can also be integrated with Slack.

Please refer to <https://grafana.com/docs/grafana/latest/alerting/configure-notifications/manage-contact-points/integrations/configure-slack/>

## Alert Rule Examples

Alerts for Trilio metrics can be configured in below way:

## Using Grafana Alerting

Grafana also allows creating alerts directly from dashboards.

### Example Alert Rules

#### Snapshot Failure Alert

Query:

```
mysql_trilio_snapshots_info{status="failed"} > 0
```

Condition:

* Trigger alert if value **> 0**
* Evaluation interval: **5 minutes**

Alert Message:

```
Trilio Snapshot Failure Detected
One or more snapshot operations have failed.
```

***

#### Restore Failure Alert

Query:

```
mysql_trilio_restore_info{status="failed"} > 0
```

Condition:

* Trigger alert if value **> 0**
* Evaluation interval: **5 minutes**

Alert Message:

```
Trilio Restore Failure Detected
One or more restore operations have failed.
```

***

#### Backup Size Alert

Query:

```
sum(mysql_trilio_backup_size_info)
```

Condition:

* Trigger alert if value **> 5000**
* Evaluation interval: **15 minutes**

Alert Message:

```
Trilio Backup Size High
Total backup storage usage exceeded 5TB threshold.
```

***

**Note:** The above are just a few examples for better understanding. Any other suitable examples may be used as required.
