> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sureops.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prometheus

> Connect Prometheus directly for PromQL metric queries during diagnosis and verification

The Prometheus integration gives sureops agents direct access to your Prometheus instance for PromQL queries — used during diagnosis to surface error rate trends, latency spikes, and service health metrics, and during verification to confirm that metrics have returned to baseline after a fix. It also populates your landscape: a Prometheus connection on its own is enough for sureops to discover your services, deployments, and call edges — you don't need Grafana as well.

> [!NOTE]
>
> If your Prometheus is already configured as a Grafana datasource, you likely **do not need this integration** — the [Grafana integration](https://docs.sureops.ai/integrations/grafana.md) covers Prometheus queries through a single MCP server. Connect Prometheus directly only if you run Prometheus standalone without Grafana, or if your Prometheus is not reachable through your Grafana instance.

***

## What this integration enables

* **PromQL queries** — agents run arbitrary PromQL against your Prometheus for metric diagnosis and verification
* **Service health checks** — agents evaluate `up`, `kube_pod_status_ready`, `kube_deployment_status_replicas_available`, and similar series during incident investigation
* **Alert correlation** — agents can query the metrics that triggered an alert to understand trend context
* **Landscape discovery** — sureops runs PromQL (`kube_pod_labels`, `kube_deployment_status_replicas`, `traces_service_graph_request_total`) through `prometheus-mcp` to build your service nodes, deployment topology, and call edges. If both Prometheus and Grafana are connected, sureops uses Prometheus, and falls back to Grafana whenever `prometheus-mcp` is unreachable, rejects the token, lacks the instant-query tool, or cannot run a test query

***

## Prerequisites

* An environment selected in the top-right context switcher — **Settings → Environment → Integrations** is scoped to that environment and stays disabled until one is selected
* A running Prometheus instance reachable from your network
* The `prometheus-mcp` server running and reachable from sureops, exposing an instant-query tool (`execute_query`, with or without a `TOOL_PREFIX` prefix, or `prometheus_query`)
* An ingress or reverse proxy in front of `prometheus-mcp` that checks a bearer token — `prometheus-mcp` has no built-in authentication

> [!NOTE]
>
> Integration connections are per-environment. Connecting Prometheus here only applies to the environment that was selected in the context switcher at the time — it does not carry over to your other environments. Repeat this connect flow for each environment that needs Prometheus.

***

## Setup

**1. Stand up prometheus-mcp**

Deploy an MCP server that speaks PromQL against your Prometheus instance. The sureops demo environment doesn't use this integration — Grafana is already connected there and covers Prometheus queries.

For your own environment, deploy [pab1it0/prometheus-mcp-server](https://github.com/pab1it0/prometheus-mcp-server) (or another MCP server that exposes one of the instant-query tools listed above), pointed at your Prometheus URL with whatever auth (none, basic, or bearer) your Prometheus instance requires configured as its upstream. These Prometheus-side credentials configure your MCP server directly — they are never entered into sureops. Run it with:

* `PROMETHEUS_MCP_SERVER_TRANSPORT=http`
* `PROMETHEUS_MCP_STATELESS_HTTP=true` — otherwise each landscape sync leaves idle sessions open on the server
* `PROMETHEUS_DISABLE_LINKS=true` — otherwise every query result carries a link to your Prometheus URL

With the `http` transport the Docker image binds `0.0.0.0:8080`; outside Docker also set `PROMETHEUS_MCP_BIND_HOST=0.0.0.0`. Its endpoint ends in `/mcp`.

**2. Put it behind bearer auth**

`prometheus-mcp` has no built-in authentication. Expose it through an ingress or reverse proxy that checks a bearer token, and keep that token for the next step.

**3. Connect in sureops**

In sureops, go to **Settings → Environment → Integrations** and click **Connect** next to Prometheus.

Fill in:

* **Integration Name** — prefilled; change it if you need to tell two configurations of this integration apart
* **MCP Server Endpoint** — the public URL of your `prometheus-mcp` server (ending in `/mcp`)
* **Bearer Token** — the token checked by the ingress or proxy in front of `prometheus-mcp`. sureops always sends this to `prometheus-mcp` as an `Authorization: Bearer` header, so there is no method to choose

Click **Save & Connect**, then go to **Settings → Environment → Landscape** and click **Re-sync now** to populate your landscape.

***

## Required credentials

Fields collected when you connect the integration:

| Field | Required | Description |
| - | - | - |
| Integration Name | No | Prefilled with a default name; distinguishes two configurations of the same integration in one environment |
| MCP Server Endpoint | Yes | Public URL of your `prometheus-mcp` server, ending in `/mcp` |
| Bearer Token | Yes | Token checked by the ingress or proxy in front of `prometheus-mcp` |

Your Prometheus instance's own URL, bearer token, or basic-auth credentials are never entered into sureops — they configure `prometheus-mcp`, which handles authentication to Prometheus on sureops' behalf.

***

## Common errors

| Error | Fix |
| - | - |
| "401 Unauthorized" | The bearer token sureops sends doesn't match what your ingress or proxy checks, or `prometheus-mcp`'s own upstream Prometheus credentials are wrong or expired. |
| "exposes no instant-query tool" | Your `prometheus-mcp` doesn't offer `execute_query`, `<prefix>_execute_query`, or `prometheus_query`. Use a version that does. |
| "Connection timed out" | Your `prometheus-mcp` server is not reachable from sureops, or your Prometheus is not reachable from the MCP server. |
| "0 series returned" | Your PromQL query is valid but returns no data. Check that kube-state-metrics series such as `kube_pod_labels` and `kube_deployment_status_replicas` are being scraped. |
| "Landscape sync ran but observed 0 services" | `prometheus-mcp` answered, but your Prometheus isn't scraping kube-state-metrics (enable the pod-label allowlist). sureops does not fall back to Grafana in this case, even if Grafana is connected. |

***

## Official documentation

* [Prometheus documentation](https://prometheus.io/docs/introduction/overview/)
* [Prometheus HTTP API](https://prometheus.io/docs/prometheus/latest/querying/api/)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.