# Prometheus

Follow the steps below to configure a service so as to extract its related alert data from Prometheus.

Squadcast will then process this information to create incidents for this service as per your preferences.

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

![](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\&token=aaca6610-9d18-4dd4-9cf5-320042f326f1)

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

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-9b480a488914b6e8cf96bb5c67b6df4d9f539cc6%2FPrometheus.png?alt=media\&token=cb6add73-85d1-4260-990b-8db9191a2e26)

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

When an alert source turns Active, 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 active if there is a recorded incident via that Alert Source for the Service.
{% endhint %}

### Create a Squadcast Webhook in Prometheus

Now open your Prometheus Alertmanager's Configuration file. (You need Prometheus Alertmanager to handle alerts generated by Prometheus. [Click here for more information ](https://prometheus.io/docs/alerting/alertmanager/))

Add a new webhook receiver and enter the URL obtained earlier as the webhook url.

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-732d66e8b92e88d6d0f376686c94475b921522dc%2Fprometheus_2.png?alt=media\&token=4641aaeb-dd54-4a82-80bc-96d5ef5359a8)

Now you can use this receiver in any of your alert routes (You can also make it the default receiver, as per your requirements).

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-daa499a3fc7f146394b76a436c9e58d31d020efc%2Fprometheus_3.png?alt=media\&token=82a5ae07-5453-4005-be36-2eaf44985af7)

Also please make sure that your alerts has the severity under labels, and annotations has the summary & description fields configured in the alert rules file as shown below in the example rules config.

```yaml
serverFiles:
  alerts:
    groups:
    - name: gt.k8s.kafka.rules
      rules:
      - alert: GtK8sKafkaConsumerLag1Warning
        expr: kafka_consumergroup_lag > 500
        for: 120m
        labels:
          severity: warning
        annotations:
          description: "Kafka consumer { { $labels.consumergroup } } lags with { { $value } } messages in topic { { $labels.topic } }"
          summary: "Kafka affected in { { $labels.instance } }"
```

{% hint style="info" %}
**Important**:

We use the summary field along with Severity & Alert group name as incident message and the description field along with generator url as incident description. Hence, **severity (labels), summary & description (annotations)** are mandatory for integration with Squadcast.
{% endhint %}

{% hint style="info" %}
**Note**:

Any alert which gets resolved from Prometheus will automatically be resolved inside Squadcast as well, unless you have explicitly set **send\_resolved** to false in the config file.
{% endhint %}

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