# Grafana Integration

{% hint style="info" %}
Are you using Grafana v9.x or higher? Please refer our [Grafana Integration (v 9.x)](https://docs.ilert.com/integrations/inbound-integrations/grafana/grafana-integration-v-9.x) guide.
{% endhint %}

## In ilert: Create a Grafana alert source

1. Go to **Alert sources** --> **Alert sources** and click on **Create new alert source**

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FjX0cS4q7woTXKajZmc1W%2FScreenshot%202023-08-28%20at%2010.21.10.png?alt=media&#x26;token=8ef3666b-84eb-4b51-abee-f07303313941" alt=""><figcaption></figcaption></figure>
2. Search for **Grafana** in the search field, click on the Grafana tile and click on **Next**.&#x20;

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FlXzQlJpaTFSR49AZk0xA%2FScreenshot%202023-08-28%20at%2010.24.23.png?alt=media&#x26;token=cffeacb4-57b9-47d4-827d-b0f6b1afd914" alt=""><figcaption></figcaption></figure>
3. Give your alert source a name, optionally assign teams and click **Next**.
4. Select an **escalation policy** by creating a new one or assigning an existing one.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FNnuZqONaIhbOf6fn4OkZ%2FScreenshot%202023-08-28%20at%2011.37.47.png?alt=media&#x26;token=8a74f7b5-5bd2-4eea-97fa-1c1dbb041333" alt=""><figcaption></figcaption></figure>
5. Select you [Alert grouping](https://docs.ilert.com/alerting/configure-alerting/alert-sources#alert-grouping) preference and click **Continue setup**. You may click **Do not group alerts** for now and change it later.&#x20;

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FueugN4JgHn1c90ggFA6u%2FScreenshot%202023-08-28%20at%2011.38.24.png?alt=media&#x26;token=b8009daf-3ca8-4264-a6fa-e42ef7333205" alt=""><figcaption></figcaption></figure>
6. The next page show additional settings such as customer alert templates or notification prioritiy. Click on **Finish setup** for now.
7. On the final page, an API key and / or webhook URL will be generated that you will need later in this guide.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fi3TIOBvNYBQfDtNpmm0A%2FScreenshot%202023-08-28%20at%2011.47.34.png?alt=media&#x26;token=6cae965a-e448-4443-8c20-37cf501c43b2" alt=""><figcaption></figcaption></figure>

## In Grafana: Add ilert Webhook as Alerting Channel <a href="#add-webhook" id="add-webhook"></a>

1. In the sidebar, go to **Alerting** → **Notification channels** and click on the **New channel** button.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76ygPnS4HUcFSX8ulm%2F-M9_6uba4jrFgQyNtISV%2F-M9_7r7_jwk5bq1PsZJw%2Fgr3.png?alt=media&#x26;token=b5d0183f-443f-445b-a75b-949289746aba" alt=""><figcaption></figcaption></figure>

2. Select **Type** webhook and in the field **URL** insert the webhookurl generated in ilert. Set the HTTP Method to **POST**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76ygPnS4HUcFSX8ulm%2F-M9_6uba4jrFgQyNtISV%2F-M9_7uNs-LjI9ItIAPLv%2Fgr4.png?alt=media&#x26;token=8e79a716-a114-4a1d-8945-965f91aa3b43" alt=""><figcaption></figcaption></figure>

3. Optionally test the integration by cliking on the **Send Test** button. Click on **Save**

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76ygPnS4HUcFSX8ulm%2F-M9_6uba4jrFgQyNtISV%2F-M9_7y0bWzI7QiLk7s0h%2Fgr5.png?alt=media&#x26;token=66fac1be-0a6b-4d8d-bf34-c16580b99ea7" alt=""><figcaption></figcaption></figure>

4. Check if an alert has been created in ilert.
5. After the Notification Channel has been created in Grafana, add it to one or more **graph alerts**.
6. Switch to any dashboard of your Grafana installation and edit a graph.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76ygPnS4HUcFSX8ulm%2F-M9_6uba4jrFgQyNtISV%2F-M9_80HwHcqKq_S-F_tx%2Fgr6.png?alt=media&#x26;token=e0ad1bfb-e163-4bce-bfaf-3a341cf16c2a" alt=""><figcaption></figcaption></figure>

7. In the edit view, open the **Alert** section via the left sidemenu and click on the green **Create Alert** button.
8. Fill in the desired **condition** and select the relevant ilert **Notification channel** under **Notifications → Send to** you created in steps 2 and 3. Do not forget to save the dashboard afterwards (in the upper right Navibar).

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76ygPnS4HUcFSX8ulm%2F-M9_6uba4jrFgQyNtISV%2F-M9_83Wirybw_1-HTGY-%2Fgr7.png?alt=media&#x26;token=481960b8-b8a7-4d21-9e0f-866837d7baca" alt=""><figcaption></figcaption></figure>

9. The integration is now set up!

## FAQ <a href="#faq" id="faq"></a>

**Will alerts in ilert be resolved automatically?**

Yes, as soon as an alert with "ok" has been resolved in Grafana, the associated alert in ilert will be resolved automatically.

**What happens when an alert is paused in Grafana, is the associated alert also accepted in ilert?**

Yes.

**Can I link Grafana to multiple alert sources in ilert?**

Yes, create a **Notification Channel** per alert source in Grafana.
