# Grafana

[<mark style="color:blue;">Grafana</mark>](https://grafana.com/) is a Data Visualization platform that allows you to query, visualize and alert on metrics no matter where they are stored.

Route detailed alerts from Grafana to the right users in Squadcast.

## How to integrate Grafana with Squadcast

### In Squadcast: Using Grafana as an Alert Source

1. Navigate to **Services** -> **Service Overview** -> select or search for your Service. Expand the accordion -> In the Alert Sources section, click **Add**.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-4fbd74e7ca0b30173c47a1d58ed6a0804a0465aa%2FAlert_Sources.png?alt=media&#x26;token=aaca6610-9d18-4dd4-9cf5-320042f326f1" alt="How to configure Grafana integration in Squadcast" width="563"><figcaption></figcaption></figure>

2\. Select **Grafana**. Copy the displayed **Webhook URL** to [configure](#in-grafana-create-a-squadcast-webhook-as-a-notification-channel) it within **Grafana.** Finish by clicking **Add Alert Source** -> **Done**.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-4788b6e63d401a1242c7774f2bca3ba57d4ff4c3%2FGrafana.png?alt=media" alt="Steps to add Grafana integration to a service in Squadcast" width="563"><figcaption></figcaption></figure>

{% hint style="warning" %} <mark style="color:orange;">**Important**</mark>**:**

When an alert source turns <mark style="color:green;">Active</mark>, it’ll show up under Configured Alert Sources. You can either generate a test alert from the integration or wait for a real-time alert to be generated by the Alert Source.\
\
An Alert Source is <mark style="color:green;">active</mark> if there is a recorded incident via that Alert Source for the Service.
{% endhint %}

### In Grafana: Create a Squadcast Webhook as a Notification Channel

1. Login to your Grafana dashboard, click on the **Alerting (Bell) icon** and select **Notification Channels**

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-2a427b40d1b32d6d5feaeb58bdbbec8242ca7463%2Fgrafana_2.png?alt=media&#x26;token=0f35c0b7-7927-40f0-8d35-1b9b68b6530a" alt="Add Notification Channels for Grafana incidents" width="196"><figcaption></figcaption></figure>

2. Click on **Add Channel** or **New Channel** and enter the Notification Channel `Name` as **Squadcast** and under `Type`, select **webhook**
3. Under `url`, enter the Webhook URL we have got from the Squadcast Service you copied before

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-6e508018c5604a11648258ad99f86ea88560dfa3%2Fgrafana_4.png?alt=media&#x26;token=0b6deff6-3cdf-4ccb-bab3-a859873282ea" alt="Add Webhook details in the Webhook URL section" width="536"><figcaption></figcaption></figure>

4. Expand `Optional Webhook Settings` and select **POST** under `Http method`.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-90225839a7b493b876785cea0012e9aa290de464%2Fgrafana_5.png?alt=media" alt="Select POST as the HTTP method" width="517"><figcaption></figcaption></figure>

5. Under `Notification Settings`, check **Default** to send all alert data to Squadcast. You can uncheck this if you want only specific Grafana Panels to send alerts to Squadcast. [<mark style="color:blue;">Move over to this section of our documentation to set up alerting for Specific Grafana Panels</mark>](#setup-alerting-for-specific-grafana-panels).

{% hint style="info" %}
**Sending Grafana Images into Squadcast**

* If you'd like to include images to your incident, check **Include Image** and you should see it as a part of your incident description in Squadcast.
* The Image URL must be public or accessible from your computer for it to be visible on Squadcast.
* Even if the Image is not accessible, the Image URL will be provided in the Incident Description.
  {% endhint %}

{% hint style="info" %}
**Helpful Grafana Links**

* [Configuring External Image Storage in Grafana](https://grafana.com/docs/grafana/latest/installation/configuration/#external-image-storage)
* [Sending Images to your Incident Alerting Tool](https://grafana.com/docs/grafana/latest/alerting/notifications/#external-image-store)
  {% endhint %}

{% hint style="warning" %}
**Important: Auto Resolve**

If you would like to enable **Auto-Resolve** in Squadcast, then make sure the **Disable Resolve Message** is unchecked.
{% endhint %}

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-4cf8ad276217ee1d2503a82d823fac4f969b7cff%2Fgrafana_6.png?alt=media&#x26;token=c6a31859-57f0-4e98-ae66-0c7d56bb4936" alt="Select the optional webhook settings" width="494"><figcaption></figcaption></figure>

6. Click on **Save** to enable the integration. You can test the integration by clicking on **Test**. This will trigger a test incident in Squadcast.

<div><figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-146f0632b29178f15db556472537f5a6ba314a4d%2Fgrafana_1.png?alt=media" alt="Save the webhook configuration settings in Grafana" width="563"><figcaption></figcaption></figure> <figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-14faf7486f2fe0e48a6c0495db6a1f15c283f5e5%2Fgrafana_2.png?alt=media" alt="Test an incident in Squadcast for Grafana incident" width="563"><figcaption></figcaption></figure> <figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-840425664989f2e006c5aeacb8679cf29049c495%2Fgrafana_3.webp?alt=media" alt="" width="563"><figcaption></figcaption></figure></div>

## Setup Alerting for Specific Grafana Panels

{% hint style="info" %}
**Pre-requisite**

Squadcast should be added as a Notification Channel in your Grafana account. [<mark style="color:blue;">Follow steps 1-5 here</mark>](#in-grafana-create-a-squadcast-webhook-as-a-notification-channel) and ensure the following:

* **Default** is unchecked to allow only specific alerts of your choosing
* **Include image** is checked if you want to add images to your Squadcast incidents
  {% endhint %}

1. After you've saved **Squadcast Webhook** as a Notification Channel for your Grafana account, navigate to the panel from your Grafana Dashboard and under options select **Edit**

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-4e66744059c5abe88da520969c3f80d29f0766b5%2Fgrafana_10.png?alt=media&#x26;token=06b8de9b-8cba-40cb-bf24-7800e53111c1" alt="Setup Alerting for Specific Grafana Panels" width="563"><figcaption></figcaption></figure>

2. Under **Alerts**, click **Create Alert** button

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-66b80866dd5eccc208bc8042bc72533a4b73ffa0%2Fgrafana_11.png?alt=media&#x26;token=524c6def-2060-4661-8d1f-475eae266b61" alt="Setup Alerting for Specific Grafana Panels" width="563"><figcaption></figcaption></figure>

3. To configure your alerts, set rules for when you want an alert triggered in the **Rules** section
4. In the **Notifications** section, under **Send to**, search and add your previously saved **Squadcast Webhook** and enter a Message for the alert and save it. The message here will be your Incident Message in Squadcast. Ensure that this message is meaningful and provides an immediate context in an on-call scenario

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-b9cd8ad0eab4b02f3c3e88aedab85d3801378431%2Fgrafana_12.png?alt=media&#x26;token=fe4abb23-56b7-4344-90b8-5fa912f35830" alt="Setup Alerting for Specific Grafana Panels using Squadcast Webhooks" width="563"><figcaption></figcaption></figure>

Now, whenever an alert is triggered in Grafana for that particular panel, an incident will be created in Squadcast.

* When it is resolved in Grafana, it will automatically get Resolved in Squadcast, provided the **Disable Resolve Message** checkbox is **unchecked**.\\

*Have any questions?* [*Ask the community*](https://community.squadcast.com/view/home)*.*


---

# 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://support.squadcast.com/integrations/alert-source-integrations-native/grafana.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.
