> For the complete documentation index, see [llms.txt](https://docs.ilert.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ilert.com/ai-and-agents/mcp/hosted/prometheus.md).

# Prometheus

Give an agent access to Prometheus, using whichever authentication method your server has.

#### Required permissions

<table><thead><tr><th width="234.4375">Tool</th><th width="177.5703125">Required Permission</th><th>Description</th></tr></thead><tbody><tr><td><code>list_time_series_metadata</code></td><td><code>Read</code></td><td>Find series by label matchers. Returns a list of time series that match the provided label matchers. This endpoint returns the label sets of all series that match the provided matchers. The response includes the metric name and all label key-value pairs for each matching series. Useful for discovering available metrics, exploring label combinations, and building queries for the <code>query_time_series_range</code> tool.</td></tr><tr><td><code>query_time_series_range</code></td><td><code>Read</code></td><td>Evaluates a Prometheus expression query over a range of time to return timer series data of metrics. Use label filters in query to filter for specific metrics. Keep time ranges as short as possible, but as wide as needed. If time series metadata is unclear and the 'query' input cannot be build, the tool <code>list_time_series_metadata</code> may be used to filter for metric labels.</td></tr></tbody></table>

#### Create API token or configure authentication

Prometheus typically uses one of the following authentication methods:

**Option 1: Basic Authentication**

If your Prometheus instance is secured with basic authentication:

1. Ensure you have a username and password configured for Prometheus access
2. These credentials will be used when configuring the Prometheus MCP server in ilert

**Option 2: Bearer Token Authentication**

If your Prometheus instance uses bearer token authentication:

1. Generate a bearer token from your authentication provider (e.g., OAuth2 proxy, reverse proxy)
2. Copy the token and temporarily store it securely (e.g., a private note)
3. You will need this token when setting up the Prometheus MCP server in ilert

**Option 3: No Authentication (Not Recommended)**

If Prometheus is not secured (not recommended for production):

1. Ensure Prometheus is only accessible within your secure network
2. No credentials are required, but this is not recommended for production environments

{% hint style="warning" %}
**Security Recommendation:** We strongly recommend securing your Prometheus instance with authentication. Exposing Prometheus without authentication can lead to unauthorized access to your metrics and system information.
{% endhint %}

#### Verify Prometheus access

Before configuring the MCP server, verify that you can access Prometheus:

```bash

# Test Prometheus query API
curl -u username:password https://prometheus.example.com/api/v1/query?query=up

# Or with bearer token
curl -H "Authorization: Bearer YOUR_TOKEN" https://prometheus.example.com/api/v1/query?query=up
```

Replace `prometheus.example.com` with your Prometheus instance URL and use your authentication credentials.

#### Connect Prometheus with agent

To connect Prometheus with your AI SRE agent:

{% stepper %}
{% step %}
Navigate to **Agents** in the ilert navigation menu
{% endstep %}

{% step %}
Open the agent detail view for the agent you want to configure
{% endstep %}

{% step %}
Go to the **Tools** tab
{% endstep %}

{% step %}
Under the **ilert hosted MCP servers** section, locate the **Prometheus** card
{% endstep %}

{% step %}
Click **Connect** on the Prometheus card
{% endstep %}

{% step %}
In the connection dialog that appears:

* **Select connector:** Choose "Create new connector" (or select an existing connector if you have one)
* **Type:** Select **Bearer Token** or **Basic Auth** from the dropdown (depending on your Prometheus authentication method)
* **Secret name:** Enter a name for your connector (e.g., "Prometheus Production" or "Prometheus Main")
* **Secret value:** Paste the bearer token or enter username:password for basic auth
* **Host URL:** Enter your Prometheus instance URL (e.g., `https://prometheus.example.com:9090`)
  {% endstep %}

{% step %}
Click **Connect** to complete the connection
{% endstep %}

{% step %}
After connecting, you can enable or disable specific tools needed for alert investigation, such as:

* `list_time_series_metadata` - Find series by label matchers to discover available metrics
* `query_time_series_range` - Query Prometheus metrics over a time range using PromQL
  {% endstep %}
  {% endstepper %}

The Prometheus integration is now connected and ready to use for root cause analysis.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ilert.com/ai-and-agents/mcp/hosted/prometheus.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
