# Import metrics from Prometheus

## Create a Prometheus metric data source

#### In ilert

1. Go to **Incident comms** --> **Metric data sources** and click on **Create metric data source.**

   <figure><img src="/files/xknX6n7A2LjPv7quYhWS" alt=""><figcaption></figcaption></figure>
2. Give the metrics data source a name (e.g. Prometheus).
3. Select **Prometheus** in **Type** dropdown list.
4. Type in your Prometheus URL. For ex.: <https://prometheus.example.org>.
5. Choose your **Authentication** method.

{% hint style="info" %}
**Warning:** We recommend that you secure your Prometheus instance by using an authentication method.
{% endhint %}

**Basic auth:**

1. Enter your login credentials for Prometheus, e.g. username and password and click on **Create metric data source**.

**Custom header:**

1. Enter a custom header name, for ex. "Cookie", if you wish to authenticate via cookie header.
2. Paste your custom header value for the header name. In case of "Cookie" enter the cookie's value here and click on **Create metric data source**.

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

## Create a metric

#### In Prometheus

1. Go to **Graph** --> Type in a **query** --> Test your result with **Execute.**

   <figure><img src="/files/ETKr8UX7xzZOJxSOMeBc" alt=""><figcaption></figcaption></figure>
2. Select a query from which you want to import the data into ilert. Copy the query, you will need it later.

**In ilert**

1. Go to **Status pages** (or **Incident comms**) --> **Metrics** and click on **Create metric.**

   <figure><img src="/files/uojVRDdLxLQbeqPIVF7e" alt=""><figcaption></figcaption></figure>
2. Select the Prometheus metrics data source that you have created above and click on **Next.**

   <figure><img src="/files/SFxn7d863idXQPNGpja4" alt=""><figcaption></figcaption></figure>
3. On the next screen, enter a metric name, a display unit and paste the metric query from step 2 "In Prometheus" above. Click **Save** to preview your metric data.

   <figure><img src="/files/EQiJuCwZ5E9n8uQpdDnj" alt=""><figcaption></figcaption></figure>
4. Preview your metric. You can make changes to your query and reload the data from Prometheus. Note that once you have created your metric, you will no longer be able to change the metric query.

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


---

# 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.ilert.com/incidents-and-status-pages/metrics/import-metrics-from-prometheus.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.
