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

# Prometheus

> Connect a Prometheus-compatible endpoint so agents can run PromQL, find down scrape targets, and read firing alerts

Connect Prometheus so CloudThinker can run PromQL queries, list metrics and labels, check scrape-target health, and read active alerts and alert rules. The connection is read-only and authenticates with no auth, a bearer token, or HTTP Basic auth.

## Supported platforms

The rule: the endpoint must answer `<your URL>/api/v1/query` at the root of its address, with no auth, a bearer token, or HTTP Basic auth.

| Platform | Supported | Notes |
| - | - | - |
| **Self-hosted Prometheus** | Yes | |
| **Thanos Querier** | Yes | |
| **Grafana Mimir, Cortex, Grafana Cloud metrics** | No | The query API sits under a path prefix such as `/prometheus` or `/api/prom`. For Grafana Cloud, use the [Grafana connection](https://docs.cloudthinker.io/guide/connections/grafana.md) instead |
| **Amazon Managed Service for Prometheus** | No | Needs AWS SigV4 request signing |
| **Google Cloud Managed Service for Prometheus** | No | Needs Google Cloud authentication |

## Prerequisites

* A Prometheus HTTP API reachable from the internet. Connections run from CloudThinker Cloud, not from inside your network.
* A publicly trusted TLS certificate if the URL uses HTTPS. There's no field to add a private CA.
* A bearer token or a username and password, if a proxy or gateway in front of Prometheus requires one.
* Permission to add connections in your CloudThinker workspace.

> [!TIP]
>
> Prometheus inside Kubernetes on a private address? Expose it through an ingress with TLS and an auth proxy that checks a bearer token or Basic auth, then allowlist CloudThinker's egress IPs. These docs don't publish CloudThinker's egress IP list: ask your CloudThinker contact, or [contact us](https://cloudthinker.io/contact). See [Reaching private services](https://docs.cloudthinker.io/guide/connections/overview.md#reaching-private-services) for other options.

> [!WARNING]
>
> The URL can't include a path. An endpoint that only answers under a prefix, such as `https://metrics.example.com/prometheus/api/v1`, fails the connection test. Expose the API at the root of a hostname instead.

## Setup

**1. Find the base URL**

Use the address you'd put in front of `/api/v1`, with no path and no trailing slash, for example `https://prometheus.example.com` or `http://prometheus.example.com:9090`.

Check it from a terminal before you connect:

```bash theme={null}
# No auth
curl -s "https://prometheus.example.com/api/v1/query?query=count(up)"
# Bearer token
curl -s -H "Authorization: Bearer <token>" "https://prometheus.example.com/api/v1/query?query=count(up)"
# Basic auth
curl -s -u <user>:<password> "https://prometheus.example.com/api/v1/query?query=count(up)"
```

Run it from a machine outside your network, with the same credentials you'll give CloudThinker.

**Success state:** the response starts with `{"status":"success","data":{"resultType":"vector"`.

**2. Pick an auth mode**

| Mode | Use it when | Fields that appear |
| - | - | - |
| **None** | The endpoint is open or limited by network rules | URL only |
| **Bearer Token** | A proxy expects `Authorization: Bearer <token>` | **PROMETHEUS\_TOKEN** |
| **Basic Auth** | A proxy expects a username and password | **PROMETHEUS\_USERNAME**, **PROMETHEUS\_PASSWORD** |

> [!WARNING]
>
> Prometheus exposes its loaded config, internal hostnames, and target addresses to anyone who can reach it. Use **None** only behind a firewall rule that allows just CloudThinker's egress IPs. Never use **None** on an endpoint open to the whole internet.

**3. Add the connection**

In the sidebar, click **More → Workspace settings → Connections**, stay on the **Builtin Connections** tab, and select **Prometheus**. Fill in:

* **Alias** (optional): a short name such as `prod-metrics`. Lowercase letters, numbers, and hyphens.
* **Description** (optional): what this Prometheus covers. Agents read it to pick the right instance when you connect more than one.
* **PROMETHEUS\_URL**: the base URL from step 1.
* **PROMETHEUS\_AUTH\_TYPE**: **None**, **Bearer Token**, or **Basic Auth**, then the credential fields that appear.
* **LOG\_LEVEL**: leave at **Info**.

Click **Connect**. CloudThinker runs `count(up)` against the endpoint, shows **Connecting** and **Verifying**, then a **Connected** status. If verification fails, it shows **Failed** and an error message appears. Match the message to [Troubleshooting](#troubleshooting).

## Connection details

| Field | Required | Default | Description |
| - | - | - | - |
| **Alias** | No | Picked for you | Short name such as `prod-metrics`. Lowercase letters, numbers, and hyphens |
| **Description** | No | `Prometheus` | What this endpoint covers. Agents read it to pick the right instance |
| **PROMETHEUS\_URL** | Yes | None | Base URL of the Prometheus HTTP API, no path, such as `https://prometheus.example.com` |
| **PROMETHEUS\_AUTH\_TYPE** | Yes | **None** | **None**, **Bearer Token**, or **Basic Auth** |
| **PROMETHEUS\_TOKEN** | Bearer Token mode | None | Token sent as `Authorization: Bearer` |
| **PROMETHEUS\_USERNAME** | Basic Auth mode | None | HTTP Basic username |
| **PROMETHEUS\_PASSWORD** | Basic Auth mode | None | HTTP Basic password |
| **LOG\_LEVEL** | No | **Info** | Connector log detail. Leave at **Info** unless support asks |

## Required permissions

Prometheus has no built-in user permissions, so access is whatever your proxy or gateway allows. CloudThinker needs read (`GET`) access under `/api/v1/` for:

| Area | Used for |
| - | - |
| Query API | Instant and range PromQL queries, series lookups |
| Metadata | Metric names, label names, type and help text |
| Targets | Scrape-target health |
| Alerts and rules | Active alerts and alert rule definitions |
| Status config | Reading the loaded configuration, only when you ask |

> [!TIP]
>
> If your proxy supports it, give CloudThinker its own token limited to `GET` requests under `/api/v1/`. Nothing in the connection writes to Prometheus.

## Agent capabilities

| Capability | What CloudThinker does |
| - | - |
| **Discovery** | Counts scrape targets (up and down), firing alerts, alert rules and their health, metrics, and labels such as `job`, `instance`, and `namespace` |
| **Instant queries** | Evaluates a PromQL expression at one point in time |
| **Range queries** | Evaluates PromQL over a window with a step. Starts at the last 15 minutes and widens if empty |
| **Metric and label discovery** | Lists metric names, type and help text, and label names, so queries use real names |
| **Target health** | Lists scrape targets and which ones are down |
| **Alerts** | Lists firing and pending alerts and the configured alert rules |
| **Configuration** | Reads the loaded config on request and redacts credential values in its answer |

When a connection first reaches **Connected**, CloudThinker runs a read-only [discovery](https://docs.cloudthinker.io/guide/connections/overview.md#what-happens-after-you-connect) of the endpoint and saves what it learns for later chats.

### Verify the connection

```text theme={null}
Run Prometheus discovery and tell me how many scrape targets are up and down, and how many alerts are firing
```

A healthy answer gives target counts by state, a firing-alert count, and a few sample metric names from your endpoint.

### Example prompts

```text theme={null}
Which scrape targets are down right now, and which jobs do they belong to?
Show 5xx rate by service from http_requests_total over the last hour and flag anything above 1%
List firing alerts and the alert rule behind each one
```

Name the metric and the labels you care about. CloudThinker can list label names, so a prompt like "split by `namespace`" gets an accurate selector faster.

To route Prometheus alerts into Resolve so incidents open automatically, set up a [webhook integration](https://docs.cloudthinker.io/guide/incident/webhook-integrations/overview.md).

## Troubleshooting

> [accordion] Prometheus rejected the credentials
>
> The endpoint returned 401 or 403. Check that **PROMETHEUS\_AUTH\_TYPE** matches what your proxy expects, then re-enter the token or username and password. A token revoked at the proxy fails the same way.

> [accordion] Prometheus has no query API at that URL
>
> The endpoint returned 404. The URL most likely has a path, such as `/api/v1` or `/prometheus`. Enter only the scheme, host, and port. If your API only answers under a prefix, it isn't supported.

> [accordion] That URL answered, but not as a Prometheus query API
>
> Something in front of Prometheus answered instead, usually a login page or an SSO proxy. Point the URL at the API itself, or use a bearer token or Basic auth that the proxy accepts without a browser login.

> [accordion] Prometheus is unreachable or didn't answer in time
>
> CloudThinker couldn't open a connection. Check the hostname, port, and TLS certificate, and that the endpoint accepts traffic from the internet. A private address such as `10.0.0.5` can't be reached from CloudThinker.

> [accordion] A query returns no data
>
> Ask CloudThinker to list metrics matching a name first, so it confirms the metric exists. Then widen the time window, since range queries start at 15 minutes.

## Security

* **Least privilege** — grant only the permissions the agents need for your use case; start read-only and widen later.
* **Read-only by default** — use read-only credentials unless you want agents to make changes through this connection.
* **Rotate credentials** — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
* **Revoke on offboarding** — remove the credential at the provider when you delete a connection or a teammate leaves.

- **No writes**: the connection only reads the Prometheus HTTP API, so a token limited to `GET` requests is enough.
- **Config holds secrets**: `/api/v1/status/config` can include scrape credentials and internal hostnames. Block that path at your proxy if you don't want it readable.

## Related

> [card] [Grafana Connection](https://docs.cloudthinker.io/guide/connections/grafana.md)
>
> Dashboards and alert rules on top of your metrics

> [card] [Kubernetes Connection](https://docs.cloudthinker.io/guide/connections/kubernetes.md)
>
> Pair metrics with the workloads that produce them


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