> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/use-harness-platform/connectors/monitoring-and-logging-systems/add-a-prometheus-connector.md).

# Add a Prometheus connector

Add a Prometheus connector so Harness can fetch metrics from your Prometheus server for verification.

Prometheus is an open-source monitoring system that collects metrics from applications and infrastructure and stores them as time-series data, which you query using PromQL. Add a Prometheus connector in Harness to let your pipelines query metrics from your Prometheus server. Harness can then use that data in Continuous Verification to compare metric behavior before and after a deployment, helping you confirm a release is healthy or trigger a rollback.

Go to [Overview](https://developer.harness.io/harness-platform/use-harness-platform/connectors/monitoring-and-logging-systems/monitoring-and-logging-systems-connectors-overview.md) for information about all monitoring and logging connectors, such as scopes and delegate selection.

***

## What you will learn from this topic

* How to [add a Prometheus connector](#add-a-prometheus-connector) to a Harness project.
* How to configure the [URL, authentication, and headers](#credentials) that Harness uses to connect to your Prometheus server.

***

## Before you begin

* **Prometheus server**: The URL of a Prometheus server that Harness or your delegate can reach over a network.
* **Harness permissions**: Permission to create connectors and secrets in Harness.

***

## Add a Prometheus connector

You can add a Prometheus connector at the project, org, or account scope. This procedure covers the project scope, and the process is the same for org and account.

1. Open your Harness project.
2. In **Project Settings**, select **Connectors**.
3. Click **New Connector**, then select **Prometheus** under **Monitoring and Logging Systems**. The Prometheus connector settings appear.

### Overview

Configure the identity fields for the connector:

1. In **Name**, enter a name for the connector. Harness generates the **Id** from the name.
2. Optionally, add a **Description** and **Tags**.
3. Click **Continue**.

![Prometheus connector overview settings](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-15f5a844083664c803e589051026f67c16933241%2Fprometheus-connector-overview.png?alt=media)

### Credentials

Configure the following settings:

1. In **URL**, enter the URL of your Prometheus server. For example, `https://prometheus.example.com:9090/`.
2. In **Authentication(optional)**, enter the following details:
   * In **Username**, enter the username of the Prometheus account.
   * In **Password**, select or create a [Harness encrypted text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md) to store the **Password**.
3. In **Headers**, optionally enter the following details:
   * In **Key**, enter the header name.
   * In **Value**, enter a **Plaintext** value, or select a [Harness encrypted text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md).
4. Click **Next**.

![Prometheus connector credentials with the URL, authentication, and headers fields](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-7454ec19bf028fa177555fd87e460f641675c6df%2Fprometheus-connector-credentials.png?alt=media)

### Delegates Setup

Select one of the following options:

* **Use any available Delegate**: Harness selects an available delegate at runtime.
* **Only use Delegates with all of the following tags**: Enter the tags of the delegates Harness must use with this connector.

The **Test Delegate Connectivity** list shows the delegates that match your selection. To add a delegate, click **Install new Delegate**.

Click **Save and Continue**.

![Prometheus connector delegates setup with the delegate connectivity list](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-2fb00e2f0e88c0db1caf8b5020614ee423ac863e%2Fprometheus-connector-delegates-setup.png?alt=media)

### Verify Connection

Click **Finish** after the connection test succeeds. The connector is listed in **Connectors** page.

***

## Sample YAML

The following example shows a YAML for the Prometheus connector created in this topic.

<details>

<summary>YAML - Prometheus connector</summary>

```yaml
connector:
  name: your-prometheus-connector # Replace with a name for your connector
  identifier: yourprometheusconnector # Replace with a unique identifier
  accountIdentifier: youraccountidentifier # Replace with your Harness account identifier
  orgIdentifier: default # Replace with your organization identifier, or remove for account scope
  projectIdentifier: yourprojectidentifier # Replace with your project identifier, or remove for org/account scope
  type: Prometheus
  spec:
    url: https://prometheus.example.com:9090/ # Replace with the URL of your Prometheus server
    headers: # Optional. Remove if your server does not require headers
      - key: key # Replace with the header name
        value: value # Replace with the header value
        valueEncrypted: false # Set to true if the value is a reference to a Harness secret
    ignoreTestConnection: false # Set to true only to skip connector preflight checks
```

</details>

For the full connector YAML schema, including how to skip connector preflight checks, go to [Create a connector using YAML](https://developer.harness.io/harness-platform/use-harness-platform/connectors/create-a-connector-using-yaml.md).

***

## Next steps

* [Use delegate selectors](https://developer.harness.io/harness-platform/use-harness-platform/delegates/delegate/manage-delegates/select-delegates-with-selectors.md): Control which delegates can connect to this connector.
* [Add a text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md): Store the Prometheus password or header values as Harness secrets.
