# Prometheus

## Setup

The following credentials keys are accepted:

* `http_url` **(required)** -> The HTTP url of the instance
* `token` (optional) -> the token key to use to access the instance
* `tenant` (optional) -> the tenant id for Grafana Mimir authentication and authorization
* `user` (optional) -> the username to use to access the instance via Basic Auth
* `password` (optional) -> the password to use to access the instance via Basic Auth
* `tls` (optional — *v1.2.7*) -> whether to use TLS for connecting (`true`/`false`).
* `cert_file` (optional — *v1.2.7*) -> the client certificate to use to access the instance via TLS (file path)
* `cert_key_file` (optional — *v1.2.7*) -> the client key to use to access the instance via TLS (file path)
* `cert_ca_file` (optional — *v1.2.7*) -> the client CA certificate to use to access the instance via TLS (file path)

### Using `sling conns`

Here are examples of setting a connection named `PROMETHEUS`. We must provide the `type=prometheus` property:

{% code overflow="wrap" %}

```bash
$ sling conns set PROMETHEUS type=prometheus http_url=<http_url> api_key=<api_key> 
```

{% endcode %}

### Environment Variable

See [here](https://docs.slingdata.io/connections/database-connections/pages/eAdVs2BHCgdr6RS8GoJC#dot-env-file-.env.sling) to learn more about the `.env.sling` file.

{% code overflow="wrap" %}

```bash
export PROMETHEUS='{type: prometheus, http_url: "<http_url>", api_key: "<api_key>" }'
```

{% endcode %}

### Sling Env File YAML

See [here](https://docs.slingdata.io/connections/database-connections/pages/eAdVs2BHCgdr6RS8GoJC#sling-env-file-env.yaml) to learn more about the sling `env.yaml` file.

```yaml
connections:
  PROMETHEUS:
    type: prometheus
    http_url: <http_url>
    api_key: <api_key>
    tls: true # if TLS connection needed
```

If you are facing issues connecting, please reach out to us at <support@slingdata.io>, on [discord](https://discord.gg/q5xtaSNDvp) or open a Github Issue [here](https://github.com/slingdata-io/sling-cli/issues).

## Guides

* [Export Data From Prometheus into any Database](https://blog.slingdata.io/export-data-from-prometheus-into-any-database)


---

# 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.slingdata.io/connections/database-connections/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.
