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

![](/files/ySERdXAZTVkotaNa2uUA)

***

### Step 2

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

<figure><img src="/files/hseWzrH9MteQVETwAvuQ" alt=""><figcaption></figcaption></figure>

***

### Step 3

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

<figure><img src="/files/zc0Ny9YhZvTAEVJvzjtv" alt=""><figcaption></figcaption></figure>

\---

### Step 4

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

<figure><img src="/files/NckC9vyKzcV7rVwabnTk" 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="/files/bXBa5dfOqS5nWyZdy0iG" alt=""><figcaption></figcaption></figure>

***

### Step 6

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

<figure><img src="/files/aF3qKW933b7WukuCaj9R" 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="/files/bMBs7WdndIk5tT9LglG8" 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trilio.io/openstack/admin-guide/grafana-monitoring/configuring-slack-webhook-and-alert-notifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
